char* CFCPerlMethod_callback_def(CFCMethod *method) { CFCType *return_type = CFCMethod_get_return_type(method); char *start = S_callback_start(method); char *callback_def = NULL; char *refcount_mods = S_callback_refcount_mods(method); if (!start) { // Can't map vars, because there's at least one type in the argument // list we don't yet support. Return a callback wrapper that throws // an error error. callback_def = S_invalid_callback_def(method); } else if (CFCType_is_void(return_type)) { callback_def = S_void_callback_def(method, start, refcount_mods); } else if (CFCType_is_object(return_type)) { callback_def = S_obj_callback_def(method, start, refcount_mods); } else if (CFCType_is_integer(return_type) || CFCType_is_floating(return_type) ) { callback_def = S_primitive_callback_def(method, start, refcount_mods); } else { // Can't map return type. callback_def = S_invalid_callback_def(method); } FREEMEM(start); FREEMEM(refcount_mods); return callback_def; }
char* CFCBindMeth_callback_def(CFCMethod *method) { CFCType *return_type = CFCMethod_get_return_type(method); char *params = S_callback_params(method); char *callback_def = NULL; char *refcount_mods = S_callback_refcount_mods(method); if (!params) { // Can't map vars, because there's at least one type in the argument // list we don't yet support. Return a callback wrapper that throws // an error error. callback_def = S_invalid_callback_def(method); } else if (CFCType_is_void(return_type)) { callback_def = S_void_callback_def(method, params, refcount_mods); } else if (CFCType_is_object(return_type)) { callback_def = S_obj_callback_def(method, params, refcount_mods); } else { callback_def = S_primitive_callback_def(method, params, refcount_mods); } FREEMEM(params); FREEMEM(refcount_mods); return callback_def; }