void rtdal_error_set_msg(int code, const char *file, int line, const char *msg) { assert(context); context->code=code; snprintf(context->msg, LSTR_LEN, "[file %s, line %d]: %s", file, line, print_error_string(code)); if (msg) { strncat(context->msg, msg, LSTR_LEN); } }
void dgc_warning(const char* fmt, ...) { char message[1024]; va_list args; va_start(args, fmt); vsnprintf(message, 1024, fmt, args); va_end(args); message[1023] = '\0'; print_error_string("# WARNING: ", NULL, message); }
void dgc_finfo(const char *fname, char *fmt, ...) { char message[1024]; va_list args; va_start(args, fmt); vsnprintf(message, 1024, fmt, args); va_end(args); message[1023] = '\0'; print_error_string("# INFO: ", fname, message); }
void dgc_die(const char* fmt, ...) { char message[1024]; va_list args; va_start(args, fmt); vsnprintf(message, 1024, fmt, args); va_end(args); message[1023] = '\0'; print_error_string("# ERROR: ", NULL, message); exit(-1); }
_ERR_CODE generate_empty_extent_set(MatchingInstance ** out, const uint32_t subscriptions, const uint32_t updates, const uint_fast8_t dimensions){ if(dimensions>MAX_DIMENSIONS) return set_error(err_too_many_dim,__FILE__, __FUNCTION__, __LINE__); (*out) = (MatchingInstance*) malloc(sizeof(MatchingInstance)); if((*out) == NULL) return set_error(err_alloc,__FILE__, __FUNCTION__, __LINE__); (*out)->dimensions=dimensions; (*out)->updates=updates; (*out)->subscriptions=subscriptions; (*out)->extent_number=(uint64_t)updates+(uint64_t)subscriptions; (*out)->extents=(extent*) malloc((*out)->extent_number*sizeof(extent)); if((*out)->extents==NULL) return set_error(err_alloc,__FILE__, __FUNCTION__, __LINE__); (*out)->matching_result = malloc(sizeof(bitmatrix)); if((*out)->matching_result == NULL) return set_error(err_alloc,__FILE__, __FUNCTION__, __LINE__); if(init_bit_matrix(((*out)->matching_result), updates, subscriptions, zero) != err_none) { print_error_string(); exit(EXIT_FAILURE); } return err_none; }