Format code.

This commit is contained in:
Danila Fedorin 2018-05-17 14:53:48 -07:00
parent 97543a3d19
commit c3a7657c71
21 changed files with 215 additions and 213 deletions

View File

@ -55,9 +55,8 @@ typedef struct libab_basetype_s libab_basetype;
* @param n the number of type parameters it has.
* @param params the parameters this basetype accepts.
*/
void libab_basetype_init(libab_basetype* basetype,
void (*free_function)(void*), int n,
const libab_basetype_param params[]);
void libab_basetype_init(libab_basetype* basetype, void (*free_function)(void*),
int n, const libab_basetype_param params[]);
/**
* Frees the given basetype.
* @param basetype the type to free.

View File

@ -2,8 +2,8 @@
#define LIBABACUS_CUSTOM_H
#include "parsetype.h"
#include "tree.h"
#include "ref_trie.h"
#include "tree.h"
/**
* A function pointer that is called
@ -110,8 +110,7 @@ void libab_behavior_init_internal(libab_behavior* behavior,
* @param type the type of the behavior.
* @param tree the tree that this behavior uses.
*/
void libab_behavior_init_tree(libab_behavior* behavior,
libab_tree* tree);
void libab_behavior_init_tree(libab_behavior* behavior, libab_tree* tree);
/**
* Frees the given behavior.
* @param behavior the behavior to free.
@ -122,7 +121,8 @@ void libab_behavior_free(libab_behavior* behavior);
* @param op the operator to initialize.
* @param variant the variant of the operator (infix, prefix, etc)
* @param precedence the precedence of the operator.
* @param associativity the associativity (left = -1, right = 1) of the operator.
* @param associativity the associativity (left = -1, right = 1) of the
* operator.
* @param type the type of the operator.
* @param func the function used to implement the operator.
*/

View File

@ -1,10 +1,10 @@
#ifndef LIBABACUS_INTERPRETER_H
#define LIBABACUS_INTERPRETER_H
#include "table.h"
#include "tree.h"
#include "impl.h"
#include "libabacus.h"
#include "table.h"
#include "tree.h"
struct libab_s;
@ -15,8 +15,8 @@ struct libab_interpreter_s {
typedef struct libab_interpreter_s libab_interpreter;
void libab_interpreter_init(libab_interpreter* intr, struct libab_s* ab);
libab_result libab_interpreter_run(libab_interpreter* intr,
libab_tree* tree, libab_ref* into);
libab_result libab_interpreter_run(libab_interpreter* intr, libab_tree* tree,
libab_ref* into);
void libab_interpreter_free(libab_interpreter* intr);
#endif

View File

@ -1,14 +1,14 @@
#ifndef LIBABACUS_H
#define LIBABACUS_H
#include "interpreter.h"
#include "custom.h"
#include "ht.h"
#include "impl.h"
#include "interpreter.h"
#include "lexer.h"
#include "parser.h"
#include "result.h"
#include "table.h"
#include "impl.h"
/**
* The main struct of libabacus,

View File

@ -56,8 +56,9 @@ libab_result libab_parsetype_init(libab_parsetype* into, libab_basetype* from,
* @param args the list of parameters to this parsetype.
* @return the result of the instantiation.
*/
libab_result libab_parsetype_init_va(libab_parsetype* into, libab_basetype* from,
size_t n, va_list args);
libab_result libab_parsetype_init_va(libab_parsetype* into,
libab_basetype* from, size_t n,
va_list args);
/**
* Frees the data associated with this type, ignoring

View File

@ -73,8 +73,8 @@ libab_result libab_ref_trie_put(libab_ref_trie* trie, const char* key,
* @param key the key to look under.
* @return a reference stored under the given key. This can be a NULL reference.
*/
void libab_ref_trie_get(const libab_ref_trie* trie,
const char* key, libab_ref* into);
void libab_ref_trie_get(const libab_ref_trie* trie, const char* key,
libab_ref* into);
/**
* Releases the trie, decrementing the refcounts of all
* the values stored inside.

View File

@ -3,9 +3,9 @@
#include "basetype.h"
#include "custom.h"
#include "refcount.h"
#include "result.h"
#include "trie.h"
#include "refcount.h"
/**
* A struct that represents a structure
@ -29,11 +29,7 @@ struct libab_table_s {
* Enum that represents the type of a table
* entry.
*/
enum libab_table_entry_variant_e {
ENTRY_VALUE,
ENTRY_BASETYPE,
ENTRY_OP
};
enum libab_table_entry_variant_e { ENTRY_VALUE, ENTRY_BASETYPE, ENTRY_OP };
/**
* An entry in the table.
@ -107,8 +103,7 @@ libab_basetype* libab_table_search_basetype(libab_table* table,
* @param string the table entry key.
* @param ref the reference to store the result into.
*/
void libab_table_search_value(libab_table* table,
const char* string,
void libab_table_search_value(libab_table* table, const char* string,
libab_ref* ref);
/**
* Stores the given entry in the table under the given key.

View File

@ -1,12 +1,12 @@
#ifndef LIBABACUS_UTIL_H
#define LIBABACUS_UTIL_H
#include "function_list.h"
#include "libds.h"
#include "liblex.h"
#include "parsetype.h"
#include "result.h"
#include "table.h"
#include "function_list.h"
#include <string.h>
/**
@ -80,7 +80,8 @@ libab_result libab_create_table(libab_ref* into, libab_ref* parent);
* @param type the type to give the value.
* @return the result of necessary allocations.
*/
libab_result libab_create_value_ref(libab_ref* into, libab_ref* data, libab_ref* type);
libab_result libab_create_value_ref(libab_ref* into, libab_ref* data,
libab_ref* type);
/**
* Allocates a new reference counted value with the given type and data.
* @param into the reference to store the allocated data into.
@ -88,7 +89,8 @@ libab_result libab_create_value_ref(libab_ref* into, libab_ref* data, libab_ref*
* @param type the type to give the value.
* @return the result of necessary allocations.
*/
libab_result libab_create_value_raw(libab_ref* into, void* data, libab_ref* type);
libab_result libab_create_value_raw(libab_ref* into, void* data,
libab_ref* type);
/**
* Allocates a function that uses internal code to run.
* @param into the reference into which to store the new function.
@ -96,7 +98,8 @@ libab_result libab_create_value_raw(libab_ref* into, void* data, libab_ref* type
* @param fun the function implementation.
* @return libab_result the result of any necessary allocations.
*/
libab_result libab_create_function_internal(libab_ref* into, void (*free_function)(void*),
libab_result libab_create_function_internal(libab_ref* into,
void (*free_function)(void*),
libab_function_ptr fun);
/**
* Allocates a function that uses a tree to run.
@ -105,7 +108,8 @@ libab_result libab_create_function_internal(libab_ref* into, void (*free_functio
* @param tree the function implementation.
* @return libab_result the result of any necessary allocations.
*/
libab_result libab_create_function_tree(libab_ref* into, void (*free_function)(void*),
libab_result libab_create_function_tree(libab_ref* into,
void (*free_function)(void*),
libab_tree* tree);
/**
* Creates a function list object, storing it in to the given reference.
@ -121,7 +125,7 @@ libab_result libab_create_function_list(libab_ref* into, libab_ref* type);
* @param value the value to store into the table.
* @param result the result of the operation.
*/
libab_result libab_put_table_value(libab_table* table,
const char* key, libab_ref* value);
libab_result libab_put_table_value(libab_table* table, const char* key,
libab_ref* value);
#endif

View File

@ -24,19 +24,22 @@ typedef struct libab_value_s libab_value;
* Initializes a new value with the given reference counted data
* and the given type.
* @param value the value to initialize.
* @param data the data for this value. Its refcount is decreased when the value is freed.
* @param data the data for this value. Its refcount is decreased when the value
* is freed.
* @param type the type of this value.
*/
void libab_value_init_ref(libab_value* value, libab_ref* data, libab_ref* type);
/**
* Initializes a new value with the given raw allocated data, and a type,
* whose basetype's free function is used to release the data when the value is freed.
* whose basetype's free function is used to release the data when the value is
* freed.
* @param value the value to initialize.
* @param data the data this value holds.
* @param type the type of this value.
* @return the result of any necessary allocations.
*/
libab_result libab_value_init_raw(libab_value* value, void* data, libab_ref* type);
libab_result libab_value_init_raw(libab_value* value, void* data,
libab_ref* type);
/**
* Frees the given value.
* @param value the value to free.

View File

@ -2,9 +2,8 @@
#include "util.h"
#include <stdlib.h>
void libab_basetype_init(libab_basetype* basetype,
void (*free_function)(void*), int n,
const libab_basetype_param params[]) {
void libab_basetype_init(libab_basetype* basetype, void (*free_function)(void*),
int n, const libab_basetype_param params[]) {
basetype->params = params;
basetype->count = n;
basetype->free_function = free_function;

View File

@ -6,8 +6,7 @@ void libab_behavior_init_internal(libab_behavior* behavior,
behavior->data_u.internal = func;
}
void libab_behavior_init_tree(libab_behavior* behavior,
libab_tree* tree) {
void libab_behavior_init_tree(libab_behavior* behavior, libab_tree* tree) {
behavior->variant = BIMPL_TREE;
behavior->data_u.tree = tree;
}
@ -33,9 +32,7 @@ void libab_operator_free(libab_operator* op) {
libab_behavior_free(&op->behavior);
}
libab_result _function_init(libab_function* function) {
return LIBAB_SUCCESS;
}
libab_result _function_init(libab_function* function) { return LIBAB_SUCCESS; }
libab_result libab_function_init_internal(libab_function* function,
libab_function_ptr fun) {
libab_result result = _function_init(function);

View File

@ -10,14 +10,13 @@ struct interpreter_state {
libab_table* base_table;
};
void _interpreter_init(struct interpreter_state* state, libab_interpreter* intr) {
void _interpreter_init(struct interpreter_state* state,
libab_interpreter* intr) {
state->ab = intr->ab;
state->base_table = libab_ref_get(&intr->ab->table);
}
void _interpreter_free(struct interpreter_state* state) {
}
void _interpreter_free(struct interpreter_state* state) {}
libab_result _interpreter_create_num_val(struct interpreter_state* state,
libab_ref* into, const char* from) {
@ -28,7 +27,8 @@ libab_result _interpreter_create_num_val(struct interpreter_state* state,
result = libab_create_value_raw(into, data, &state->ab->type_num);
if (result != LIBAB_SUCCESS) {
((libab_parsetype*) libab_ref_get(&state->ab->type_num))->data_u.base->free_function(data);
((libab_parsetype*)libab_ref_get(&state->ab->type_num))
->data_u.base->free_function(data);
}
} else {
result = LIBAB_MALLOC;
@ -41,9 +41,9 @@ libab_result _interpreter_create_num_val(struct interpreter_state* state,
return result;
}
libab_result _interpreter_run(struct interpreter_state* state,
libab_tree* tree, libab_ref* into,
libab_ref* scope, int force_scope) {
libab_result _interpreter_run(struct interpreter_state* state, libab_tree* tree,
libab_ref* into, libab_ref* scope,
int force_scope) {
libab_result result = LIBAB_SUCCESS;
libab_ref new_scope;
int needs_scope = libab_tree_has_scope(tree->variant) || force_scope;
@ -60,7 +60,8 @@ libab_result _interpreter_run(struct interpreter_state* state,
libab_ref_null(into);
while (result == LIBAB_SUCCESS && index < tree->children.size) {
libab_ref_free(into);
result = _interpreter_run(state, vec_index(&tree->children, index), into, scope, 0);
result = _interpreter_run(state, vec_index(&tree->children, index),
into, scope, 0);
index++;
}
} else if (tree->variant == TREE_NUM) {
@ -76,8 +77,8 @@ libab_result _interpreter_run(struct interpreter_state* state,
return result;
}
libab_result libab_interpreter_run(libab_interpreter* intr,
libab_tree* tree, libab_ref* into) {
libab_result libab_interpreter_run(libab_interpreter* intr, libab_tree* tree,
libab_ref* into) {
struct interpreter_state state;
libab_result result;
@ -88,6 +89,4 @@ libab_result libab_interpreter_run(libab_interpreter* intr,
return result;
}
void libab_interpreter_free(libab_interpreter* intr) {
}
void libab_interpreter_free(libab_interpreter* intr) {}

View File

@ -10,26 +10,17 @@ void _free_function_list(void* function_list) {
free(function_list);
}
static libab_basetype _basetype_function_list = {
_free_function_list,
NULL,
0
};
static libab_basetype _basetype_function_list = {_free_function_list, NULL, 0};
void _free_function(void* function) {
libab_function_free(function);
free(function);
}
static libab_basetype_param _basetype_function_params[] = {
{ BT_LIST, NULL }
};
static libab_basetype_param _basetype_function_params[] = {{BT_LIST, NULL}};
static libab_basetype _basetype_function = {
_free_function,
_basetype_function_params,
1
};
static libab_basetype _basetype_function = {_free_function,
_basetype_function_params, 1};
libab_result _prepare_types(libab* ab, void (*free_function)(void*));
@ -108,8 +99,8 @@ libab_result _register_operator(libab* ab, const char* op,
if ((new_entry = malloc(sizeof(*new_entry)))) {
new_entry->variant = ENTRY_OP;
new_operator = &(new_entry->data_u.op);
libab_operator_init(new_operator, token_type,
precedence, associativity, type, func);
libab_operator_init(new_operator, token_type, precedence, associativity,
type, func);
} else {
result = LIBAB_MALLOC;
}
@ -157,7 +148,8 @@ libab_result libab_register_operator_postfix(libab* ab, const char* op,
libab_result _create_value_function_internal(libab_ref* into, libab_ref* type,
libab_function_ptr func) {
libab_ref function_ref;
libab_result result = libab_create_function_internal(&function_ref, _free_function, func);
libab_result result =
libab_create_function_internal(&function_ref, _free_function, func);
libab_ref_null(into);
if (result == LIBAB_SUCCESS) {
libab_ref_free(into);
@ -179,7 +171,9 @@ libab_result _create_value_function_list(libab_ref* into, libab_ref* type) {
return result;
}
libab_result _libab_register_function_existing(libab* ab, libab_table_entry* entry, libab_ref* function_val) {
libab_result _libab_register_function_existing(libab* ab,
libab_table_entry* entry,
libab_ref* function_val) {
libab_value* old_value;
libab_parsetype* old_type;
libab_result result = LIBAB_SUCCESS;
@ -192,9 +186,11 @@ libab_result _libab_register_function_existing(libab* ab, libab_table_entry* ent
result = libab_function_list_insert(list, function_val);
} else if (old_type->data_u.base == &_basetype_function) {
libab_ref new_list;
result = _create_value_function_list(&new_list, &ab->type_function_list);
result =
_create_value_function_list(&new_list, &ab->type_function_list);
if (result == LIBAB_SUCCESS) {
libab_function_list* list = libab_ref_get(&((libab_value*) libab_ref_get(&new_list))->data);
libab_function_list* list =
libab_ref_get(&((libab_value*)libab_ref_get(&new_list))->data);
result = libab_function_list_insert(list, &entry->data_u.value);
if (result == LIBAB_SUCCESS) {
result = libab_function_list_insert(list, function_val);
@ -211,7 +207,8 @@ libab_result _libab_register_function_existing(libab* ab, libab_table_entry* ent
return result;
}
libab_result _libab_register_function_new(libab* ab, const char* name, libab_ref* function_val) {
libab_result _libab_register_function_new(libab* ab, const char* name,
libab_ref* function_val) {
libab_result result = LIBAB_SUCCESS;
libab_table_entry* entry;
if ((entry = malloc(sizeof(*entry)))) {
@ -238,10 +235,11 @@ libab_result libab_register_function(libab* ab, const char* name,
_create_value_function_internal(&function_value, type, func);
if (result == LIBAB_SUCCESS) {
existing_entry =
libab_table_search_filter(libab_ref_get(&ab->table), name, NULL, libab_table_compare_value);
existing_entry = libab_table_search_filter(
libab_ref_get(&ab->table), name, NULL, libab_table_compare_value);
if (existing_entry) {
result = _libab_register_function_existing(ab, existing_entry, &function_value);
result = _libab_register_function_existing(ab, existing_entry,
&function_value);
} else {
result = _libab_register_function_new(ab, name, &function_value);
}
@ -283,8 +281,8 @@ libab_result _prepare_types(libab* ab, void (*free_function)(void*)) {
if (result == LIBAB_SUCCESS) {
libab_ref_free(&ab->type_num);
result = libab_instantiate_basetype(&ab->basetype_num,
&ab->type_num, 0);
result =
libab_instantiate_basetype(&ab->basetype_num, &ab->type_num, 0);
}
if (result == LIBAB_SUCCESS) {
@ -325,16 +323,15 @@ libab_result libab_create_type(libab* ab, libab_ref* into, const char* type) {
result = libab_parser_parse_type(&ab->parser, &tokens, type, into);
}
if (result == LIBAB_SUCCESS) {
result = libab_resolve_parsetype(libab_ref_get(into), libab_ref_get(&ab->table));
result = libab_resolve_parsetype(libab_ref_get(into),
libab_ref_get(&ab->table));
}
ll_foreach(&tokens, NULL, compare_always, libab_lexer_foreach_match_free);
ll_free(&tokens);
return result;
}
libab_basetype* libab_get_basetype_num(libab* ab) {
return &ab->basetype_num;
}
libab_basetype* libab_get_basetype_num(libab* ab) { return &ab->basetype_num; }
libab_basetype* libab_get_basetype_function(libab* ab) {
return &_basetype_function;

View File

@ -1169,7 +1169,8 @@ libab_result libab_parser_parse(libab_parser* parser, ll* tokens,
const char* string, libab_tree** store_into) {
libab_result result;
struct parser_state state;
_parser_state_init(&state, tokens, string, libab_ref_get(&parser->ab->table));
_parser_state_init(&state, tokens, string,
libab_ref_get(&parser->ab->table));
result = _parse_block(&state, store_into, 0);
if (result == LIBAB_SUCCESS) {
@ -1182,7 +1183,8 @@ libab_result libab_parser_parse_type(libab_parser* parser, ll* tokens,
const char* string,
libab_ref* store_into) {
struct parser_state state;
_parser_state_init(&state, tokens, string, libab_ref_get(&parser->ab->table));
_parser_state_init(&state, tokens, string,
libab_ref_get(&parser->ab->table));
return _parse_type(&state, store_into);
}

View File

@ -11,13 +11,15 @@ libab_result libab_parsetpe_init(libab_parsetype* type, libab_basetype* from,
return result;
}
libab_result libab_parsetype_init_va(libab_parsetype* type, libab_basetype* from,
size_t n, va_list args) {
libab_result libab_parsetype_init_va(libab_parsetype* type,
libab_basetype* from, size_t n,
va_list args) {
libab_result result = LIBAB_SUCCESS;
size_t base_index = 0, param_index = 0;
int free_vec = 0;
if(from->count > n) result = LIBAB_BAD_TYPE;
if (from->count > n)
result = LIBAB_BAD_TYPE;
while (base_index < from->count && param_index < n) {
if (from->params[base_index].variant == BT_NAME) {
base_index++;
@ -34,7 +36,8 @@ libab_result libab_parsetype_init_va(libab_parsetype* type, libab_basetype* from
if (result == LIBAB_SUCCESS && n) {
type->variant |= LIBABACUS_TYPE_F_PARENT;
result = libab_ref_vec_init(&type->children);
if(result == LIBAB_SUCCESS) free_vec = 1;
if (result == LIBAB_SUCCESS)
free_vec = 1;
}
while (n-- && result == LIBAB_SUCCESS) {

View File

@ -1,9 +1,7 @@
#include "ref_trie.h"
#include <stdlib.h>
void libab_ref_trie_init(libab_ref_trie* trie) {
trie->head = NULL;
}
void libab_ref_trie_init(libab_ref_trie* trie) { trie->head = NULL; }
void _libab_ref_trie_free(libab_ref_trie_node* node) {
if (node == NULL)
@ -115,8 +113,8 @@ libab_result libab_ref_trie_put(libab_ref_trie* trie, const char* key,
return result;
}
void libab_ref_trie_get(const libab_ref_trie* trie,
const char* key, libab_ref* into) {
void libab_ref_trie_get(const libab_ref_trie* trie, const char* key,
libab_ref* into) {
libab_ref_trie_node* current = trie->head;
while (current && *key) {
while (current && current->key != *key) {

View File

@ -17,9 +17,7 @@ libab_result libab_ref_new(libab_ref* ref, void* data,
return result;
}
void libab_ref_null(libab_ref* ref) {
ref->null = 1;
}
void libab_ref_null(libab_ref* ref) { ref->null = 1; }
void _libab_ref_changed(libab_ref* ref) {
if (ref->count->strong == 0) {

View File

@ -65,16 +65,15 @@ libab_operator* libab_table_search_operator(libab_table* table,
libab_basetype* libab_table_search_basetype(libab_table* table,
const char* string) {
libab_table_entry* entry =
libab_table_search_filter(table, string, NULL, libab_table_compare_basetype);
libab_table_entry* entry = libab_table_search_filter(
table, string, NULL, libab_table_compare_basetype);
return entry ? entry->data_u.basetype : NULL;
}
void libab_table_search_value(libab_table* table,
const char* string,
void libab_table_search_value(libab_table* table, const char* string,
libab_ref* ref) {
libab_table_entry* entry =
libab_table_search_filter(table, string, NULL, libab_table_compare_value);
libab_table_entry* entry = libab_table_search_filter(
table, string, NULL, libab_table_compare_value);
if (entry) {
libab_ref_copy(&entry->data_u.value, ref);
} else {

View File

@ -1,7 +1,7 @@
#include "util.h"
#include "value.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdlib.h>
libab_result libab_convert_lex_result(liblex_result to_convert) {
libab_result result = LIBAB_SUCCESS;
@ -155,7 +155,8 @@ void _free_value(void* value) {
free(value);
}
libab_result libab_create_value_ref(libab_ref* into, libab_ref* data, libab_ref* type) {
libab_result libab_create_value_ref(libab_ref* into, libab_ref* data,
libab_ref* type) {
libab_value* value;
libab_result result = LIBAB_SUCCESS;
if ((value = malloc(sizeof(*value)))) {
@ -175,7 +176,8 @@ libab_result libab_create_value_ref(libab_ref* into, libab_ref* data, libab_ref*
return result;
}
libab_result libab_create_value_raw(libab_ref* into, void* data, libab_ref* type) {
libab_result libab_create_value_raw(libab_ref* into, void* data,
libab_ref* type) {
libab_value* value;
libab_result result = LIBAB_SUCCESS;
@ -200,7 +202,8 @@ libab_result libab_create_value_raw(libab_ref* into, void* data, libab_ref* type
return result;
}
libab_result libab_create_function_internal(libab_ref* into, void (*free_function)(void*),
libab_result libab_create_function_internal(libab_ref* into,
void (*free_function)(void*),
libab_function_ptr fun) {
libab_function* new_function;
libab_result result = LIBAB_SUCCESS;
@ -226,7 +229,8 @@ libab_result libab_create_function_internal(libab_ref* into, void (*free_functio
return result;
}
libab_result libab_create_function_tree(libab_ref* into, void (*free_function)(void*),
libab_result libab_create_function_tree(libab_ref* into,
void (*free_function)(void*),
libab_tree* tree) {
libab_function* new_function;
libab_result result = LIBAB_SUCCESS;
@ -264,7 +268,8 @@ libab_result libab_create_function_list(libab_ref* into, libab_ref* type) {
if (result == LIBAB_SUCCESS) {
result = libab_ref_new(into, list,
((libab_parsetype*) libab_ref_get(type))->data_u.base->free_function);
((libab_parsetype*)libab_ref_get(type))
->data_u.base->free_function);
if (result != LIBAB_SUCCESS) {
libab_function_list_free(list);
}
@ -278,8 +283,8 @@ libab_result libab_create_function_list(libab_ref* into, libab_ref* type) {
return result;
}
libab_result libab_put_table_value(libab_table* table,
const char* key, libab_ref* value) {
libab_result libab_put_table_value(libab_table* table, const char* key,
libab_ref* value) {
libab_table_entry* entry;
libab_result result = LIBAB_SUCCESS;
if ((entry = malloc(sizeof(*entry)))) {

View File

@ -1,16 +1,19 @@
#include "value.h"
#include "parsetype.h"
void libab_value_init_ref(libab_value* value, libab_ref* data, libab_ref* type) {
void libab_value_init_ref(libab_value* value, libab_ref* data,
libab_ref* type) {
libab_ref_copy(data, &value->data);
libab_ref_copy(type, &value->type);
}
libab_result libab_value_init_raw(libab_value* value, void* data, libab_ref* type) {
libab_result libab_value_init_raw(libab_value* value, void* data,
libab_ref* type) {
libab_result result = LIBAB_SUCCESS;
libab_ref tmp_ref;
result = libab_ref_new(&tmp_ref, data,
result = libab_ref_new(
&tmp_ref, data,
((libab_parsetype*)libab_ref_get(type))->data_u.base->free_function);
if (result == LIBAB_SUCCESS) {