Add methods to get pointers to basetypes, for comparison.

This commit is contained in:
Danila Fedorin 2018-05-11 20:12:03 -07:00
parent 8f48a16a25
commit 989774cec5
2 changed files with 32 additions and 0 deletions

View File

@ -139,6 +139,26 @@ libab_result libab_register_basetype(libab* ab, const char* name,
* @return the result of the operation. * @return the result of the operation.
*/ */
libab_result libab_create_type(libab* ab, libab_ref* into, const char* type); libab_result libab_create_type(libab* ab, libab_ref* into, const char* type);
/**
* Finds and returns the built-in libabacus number type.
* @param ab the ab instance for which to return a type.
* @return the num basetype.
*/
libab_basetype* libab_get_basetype_num(libab* ab);
/**
* Finds and returns the built-in libabacus function type.
* @param ab the ab instance for which to return a type.
* @return the function basetype.
*/
libab_basetype* libab_get_basetype_function(libab* ab);
/**
* Finds and returns the built-in libabacus function list type.
* @param ab the ab instance for which to return a type.
* @return the function list basetype.
*/
libab_basetype* libab_get_basetype_function_list(libab* ab);
/** /**
* Releases all the resources allocated by libabacus. * Releases all the resources allocated by libabacus.
* @param ab the libabacus instance to release. * @param ab the libabacus instance to release.

View File

@ -258,6 +258,18 @@ libab_result libab_create_type(libab* ab, libab_ref* into, const char* type) {
return result; return result;
} }
libab_basetype* libab_get_basetype_num(libab* ab) {
return &ab->basetype_num;
}
libab_basetype* libab_get_basetype_function(libab* ab) {
return &_basetype_function;
}
libab_basetype* libab_get_basetype_function_list(libab* ab) {
return &_basetype_function_list;
}
libab_result libab_free(libab* ab) { libab_result libab_free(libab* ab) {
libab_ref_free(&ab->table); libab_ref_free(&ab->table);
libab_ref_free(&ab->type_num); libab_ref_free(&ab->type_num);