Add error printing functions to GDNative

This commit is contained in:
sheepandshepherd 2017-05-09 20:18:20 +02:00
parent 32afcbc482
commit 99e07448d1
2 changed files with 13 additions and 0 deletions

View file

@ -30,6 +30,7 @@
#include "godot.h" #include "godot.h"
#include "class_db.h" #include "class_db.h"
#include "error_macros.h"
#include "gdnative.h" #include "gdnative.h"
#include "global_config.h" #include "global_config.h"
#include "global_constants.h" #include "global_constants.h"
@ -215,6 +216,14 @@ void GDAPI godot_free(void *p_ptr) {
memfree(p_ptr); memfree(p_ptr);
} }
void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line) {
_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_ERROR);
}
void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line) {
_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_WARNING);
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -404,6 +404,10 @@ void GDAPI *godot_alloc(int p_bytes);
void GDAPI *godot_realloc(void *p_ptr, int p_bytes); void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
void GDAPI godot_free(void *p_ptr); void GDAPI godot_free(void *p_ptr);
//print using Godot's error handler list
void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line);
void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif