*reordered a few functions.

This commit is contained in:
Wang Renxin 2018-06-29 16:14:24 +08:00
parent bb7b573a20
commit a5b3447918
3 changed files with 26 additions and 26 deletions

Binary file not shown.

View File

@ -14638,6 +14638,30 @@ _exit:
return result; return result;
} }
/* Set an import handler to a MY-BASIC environment */
int mb_set_import_handler(struct mb_interpreter_t* s, mb_import_handler_t h) {
int result = MB_FUNC_OK;
if(!s) {
result = MB_FUNC_ERR;
goto _exit;
}
s->import_handler = h;
_exit:
return result;
}
/* Register an allocator and a freer globally */
int mb_set_memory_manager(mb_memory_allocate_func_t a, mb_memory_free_func_t f) {
_mb_allocate_func = a;
_mb_free_func = f;
return MB_FUNC_OK;
}
/* Get whether GC is enabled */ /* Get whether GC is enabled */
bool_t mb_get_gc_enabled(struct mb_interpreter_t* s) { bool_t mb_get_gc_enabled(struct mb_interpreter_t* s) {
if(!s) return false; if(!s) return false;
@ -14704,22 +14728,6 @@ _exit:
return result; return result;
} }
/* Set an import handler to a MY-BASIC environment */
int mb_set_import_handler(struct mb_interpreter_t* s, mb_import_handler_t h) {
int result = MB_FUNC_OK;
if(!s) {
result = MB_FUNC_ERR;
goto _exit;
}
s->import_handler = h;
_exit:
return result;
}
/* Safe stdin reader function */ /* Safe stdin reader function */
int mb_gets(const char* pmt, char* buf, int s) { int mb_gets(const char* pmt, char* buf, int s) {
int result = 0; int result = 0;
@ -14754,14 +14762,6 @@ char* mb_memdup(const char* val, unsigned size) {
return result; return result;
} }
/* Register an allocator and a freer globally */
int mb_set_memory_manager(mb_memory_allocate_func_t a, mb_memory_free_func_t f) {
_mb_allocate_func = a;
_mb_free_func = f;
return MB_FUNC_OK;
}
/* ========================================================} */ /* ========================================================} */
/* /*

View File

@ -670,15 +670,15 @@ MBAPI int mb_set_error_handler(struct mb_interpreter_t* s, mb_error_handler_t h)
MBAPI int mb_set_printer(struct mb_interpreter_t* s, mb_print_func_t p); MBAPI int mb_set_printer(struct mb_interpreter_t* s, mb_print_func_t p);
MBAPI int mb_set_inputer(struct mb_interpreter_t* s, mb_input_func_t p); MBAPI int mb_set_inputer(struct mb_interpreter_t* s, mb_input_func_t p);
MBAPI int mb_set_import_handler(struct mb_interpreter_t* s, mb_import_handler_t h);
MBAPI int mb_set_memory_manager(mb_memory_allocate_func_t a, mb_memory_free_func_t f);
MBAPI bool_t mb_get_gc_enabled(struct mb_interpreter_t* s); MBAPI bool_t mb_get_gc_enabled(struct mb_interpreter_t* s);
MBAPI int mb_set_gc_enabled(struct mb_interpreter_t* s, bool_t gc); MBAPI int mb_set_gc_enabled(struct mb_interpreter_t* s, bool_t gc);
MBAPI int mb_gc(struct mb_interpreter_t* s, int_t* collected/* = NULL*/); MBAPI int mb_gc(struct mb_interpreter_t* s, int_t* collected/* = NULL*/);
MBAPI int mb_get_userdata(struct mb_interpreter_t* s, void** d); MBAPI int mb_get_userdata(struct mb_interpreter_t* s, void** d);
MBAPI int mb_set_userdata(struct mb_interpreter_t* s, void* d); MBAPI int mb_set_userdata(struct mb_interpreter_t* s, void* d);
MBAPI int mb_set_import_handler(struct mb_interpreter_t* s, mb_import_handler_t h);
MBAPI int mb_gets(const char* pmt, char* buf, int s); MBAPI int mb_gets(const char* pmt, char* buf, int s);
MBAPI char* mb_memdup(const char* val, unsigned size); MBAPI char* mb_memdup(const char* val, unsigned size);
MBAPI int mb_set_memory_manager(mb_memory_allocate_func_t a, mb_memory_free_func_t f);
#ifdef MB_COMPACT_MODE #ifdef MB_COMPACT_MODE
# pragma pack() # pragma pack()