/*
19 Dec 94 - 15 Sept 95 - 12 June 98
Alain de Cheveigne, LLF, CNRS/Universite Paris 7.
Debugging wrapper for malloc() functions.
*/
#define MWRAP_C
#define MWRAP
#include "mwrap.h"
void mexErrMsgTxt(
const char *error_msg
);
#define GROWSIZE 8192 * 10 /* number of nodes preallocated in
node pool. Each node is 20 bytes. */
/*
#define NL fprintf(stderr,"\n");
#define DOT fprintf(stderr,".");
#define DASH fprintf(stderr,"-");
#define OK \
{fprintf(stderr, "%s<%d> ", __FILE__, __LINE__);\
fprintf(stderr,"OK\n");}
*/
#define DIE(s) do {char c[100]; sprintf(c, "%d %s ", mwrap_line, s); mexErrMsgTxt(c);} while(0)
#define DIE1(s,v1) do {char c[100]; sprintf(c, "%d %s", mwrap_line, s); mexErrMsgTxt(c);} while(0)
#define DIE2(s,v1,v2) do {char c[100]; sprintf(c, "%d %s", mwrap_line, s); mexErrMsgTxt(c);} while(0)
#define DIE3(s,v1,v2,v3) do {char c[100]; sprintf(c, "%d %s", mwrap_line, s); mexErrMsgTxt(c);} while(0)
#define PRINT3(string, v1, v2, v3) mexErrMsgTxt((string));
/*
#define DIE(s) \
do {fprintf(stderr, "%s/%d: ", mwrap_file, mwrap_line);\
fprintf(stderr, (s)); fprintf(stderr, "\n"); exit(1);} \
while (0)
#define DIE1(s, value) \
do {fprintf(stderr, "%s/%d: ", mwrap_file, mwrap_line);\
fprintf(stderr, (s), (value)); fprintf(stderr, "\n"); exit(1);} \
while (0)
#define DIE2(s, v1,v2) \
do {fprintf(stderr, "%s/%d: ", mwrap_file, mwrap_line);\
fprintf(stderr, s, (v1),(v2)); fprintf(stderr, "\n"); exit(1);} \
while (0)
#define DIE3(s,v1,v2,v3) \
do {fprintf(stderr, "%s/%d: ", mwrap_file, mwrap_line);\
fprintf(stderr, s, (v1), (v2), (v3)); \
fprintf(stderr, "\n"); exit(1);} while (0)
#define PRINT3(string, v1, v2, v3) do {fprintf(stderr,string, v1,v2,v3);} \
while(0)
*/
#define NOK(n) mwrap_checknode(n);
/* MWRAP_SPLAY() defined as a macro to allow slightly faster splaying,
especially when the node is already root or next to root */
#define MWRAP_SPLAY(n) do { \
mwrap_node father; \
father = (n)->up; \
while (father) { \
if (!father->up) MWRAP_SINGLE_ROTATE(n); \
else MWRAP_DOUBLE_ROTATE(n); \
father = (n)->up; \
} \
} while (0);
#define MWRAP_SINGLE_ROTATE(n) do { \
mwrap_node p, B; \
p = (n)->up; \
if (p->left == (n)) { \
B = (n)->right; (n)->right = p; \
p->left = B; if (B) B->up = p; \
} else { \
B = (n)->left; (n)->left = p; \
p->right = B; if (B) B->up = p; \
} \
p->up = (n); \
n->up = NULL; \
} while (0)
#define MWRAP_DOUBLE_ROTATE(n) mwrap_double_rotate(n)
/* update lowest and highest known stack address */
#define STACK(p) do {\
if (mwrap_stack_lo>(char *)(p)) mwrap_stack_lo=(char *)(p); \
if (mwrap_stack_hi<(char *)(p)) mwrap_stack_hi=(char *)(p); \
} while (0)
static void mwrap_register(char *lo, char *hi);
static void mwrap_delete(mwrap_node n);
static mwrap_node mwrap_leftmost(mwrap_node tree);
static void mwrap_checksub(mwrap_node tree, char *low, char *high);
static mwrap_node mwrap_newnode();
static void mwrap_freenode(mwrap_node n) ;
static void mwrap_single_rotate(mwrap_node n);
static void mwrap_double_rotate(mwrap_node n);
static void mwrap_splay(mwrap_node n);
static void mwrap_check_stack(char *p); /* check if pointer to stack */
static char *heap_lowest; /* lowest address so far */
static char *heap_highest; /* highest address so far +1 */
static mwrap_node tree_lowest; /* lowest address used by tree */
static mwrap_node tree_highest; /* highest address used by tree +1 */
void mwrap_checktree(char *file, long line);
/* global variables */
mwrap_node mwrap_tree = NULL; /* the tree */
char *mwrap_file; /* caller source file */
long mwrap_line; /* line in caller source file */
char *mwrap_stack_lo = (char *) -1; /* lowest known stack address */
char *mwrap_stack_hi = (char *) -1; /* highest known stack address */
/* Mwrap wraps the four basic malloc routines:
malloc, calloc , realloc, free. If you wish it to handle more
exotic routines, turn on the following switches. */
#define MWRAP_CFREE /* cfree() */
#define MWRAP_VMALLOC /* vmalloc() */
#define MWRAP_VFREE /* vfree() */
/* #define MWRAP_MEMALIGN /* memalign */
/*
wrappers for routines of the malloc family
*/
/* malloc */
DATATYPE *mwrap_malloc(SIZETYPE size, char *file, long line) {
DATATYPE *p;
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
p = malloc(size);
if (!p) DIE1("malloc failed (size=%d)", size);
/* check for negative size or overflow */
if ((char *) p > (char *) p+size)
DIE1("malloc called with size = %d", size);
mwrap_register((char *) p, ((char *) p + size));
return p;
}
/* free */
VOIDTYPE mwrap_free(DATATYPE *p, char *file, long line) {
int dummy; STACK(&dummy);
/*fprintf(stderr, "%#x\n", p); */
mwrap_file = file;
mwrap_line = line;
mwrap_bok(p, file, line); /* side effect: node is root of mwrap_tree */
mwrap_delete(mwrap_tree); /* delete that node */
free(p);
}
/* realloc */
DATATYPE *mwrap_realloc(DATATYPE *p, SIZETYPE size, char *file, long line) {
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
mwrap_bok(p, file, line); /* side effect: node is root of mwrap_tree */
mwrap_delete(mwrap_tree); /* delete that node */
p = realloc(p, size);
if (!p) DIE1("ralloc failed (size=%d)", size);
if ((char *) p > (char *) p+size)
DIE1("realloc called with size = %d", size);
mwrap_register((char *) p, (char *) p + size);
return p;
}
/* calloc */
DATATYPE *mwrap_calloc(SIZETYPE n, SIZETYPE size, char *file, long line) {
DATATYPE *p;
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
if (size <= 0) DIE1("calloc called with size = %d", size);
p = calloc(n, size);
if (!p) DIE2("calloc failed (n=%d, size=%d)", n, size);
mwrap_register((char *) p, (char *) p + n*size);
return p;
}
/* cfree */
#ifdef MWRAP_CFREE
VOIDTYPE mwrap_cfree(DATATYPE *p, char *file, long line) {
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
mwrap_bok(p, file, line); /* side effect: node is root of mwrap_tree */
mwrap_delete(mwrap_tree);
/* cfree(p); */ free(p);
}
#endif
/* valloc */
#ifdef MWRAP_VALLOC
DATATYPE *mwrap_valloc(SIZETYPE size, char *file, long line) {
DATATYPE *p;
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
p = (DATATYPE *) valloc(size);
if (!p) DIE1("valloc failed (size=%d)", size);
if ((char *) p > (char *p) p+size)
DIE1("valloc called with size = %d", size);
mwrap_register((char *) p, (char *) p + size);
return p;
}
#endif
/* vfree */
#ifdef MWRAP_VFREE
VOIDTYPE mwrap_vfree(DATATYPE *p, char *file, long line) {
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
mwrap_bok(p, file, line); /* side effect: node is root of mwrap_tree */
mwrap_delete(mwrap_tree);
/* vfree(p); */ free(p);
}
#endif
/* memalign */
#ifdef MWRAP_MEMALIGN
DATATYPE *mwrap_memalign(SIZETYPE alignment, SIZETYPE size, char *file, long line) {
DATATYPE *p;
int dummy; STACK(&dummy);
mwrap_file = file;
mwrap_line = line;
p = (DATATYPE *) memalign(alignment, size);
/* dunno why I need the cast... */
if (!p) DIE2("memalign failed (alignment=%d, size=%d)", alignment, size);
if ((char *) p > (char *p) p+size)
DIE1("memalign called with size = %d", size);
mwrap_register((char *) p, (char *) p + size);
return p;
}
#endif
/* unwrapped versions */
DATATYPE *nowrap_malloc(SIZETYPE size) {
return malloc(size);
}
/* free */
VOIDTYPE nowrap_free(DATATYPE *p) {
free(p);
}
/* realloc */
DATATYPE *nowrap_realloc(DATATYPE *p, SIZETYPE size) {
return realloc(p, size);
}
/* calloc */
DATATYPE *nowrap_calloc(SIZETYPE n, SIZETYPE size) {
return calloc(n, size);
}
/* cfree */
#ifdef MWRAP_CFREE
VOIDTYPE nowrap_cfree(DATATYPE *p) {
/
没有合适的资源?快使用搜索试试~ 我知道了~
Just that (for Matlab).zip
共343个文件
m:170个
wav:28个
mex:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 113 浏览量
2023-07-23
10:13:01
上传
评论
收藏 35.19MB ZIP 举报
温馨提示
Just that (for Matlab).zip
资源推荐
资源详情
资源评论
收起资源包目录
Just that (for Matlab).zip (343个子文件)
dftoperiod_gen.%b5 30KB
rsmooth.%b5 30KB
cumnorm_inplace.%b5 30KB
minparabolic.%b5 30KB
dftoperiod.%b5 30KB
rsum_inplace.%b5 30KB
rdiff_inplace.%b5 30KB
interp_inplace.%b5 30KB
mininrange.%b5 30KB
dftoperiod2.%b5 30KB
maceo.aiff 822KB
totodrum.aiff 478KB
meters2.aiff 410KB
KCsunshine.aiff 311KB
Domino.aiff 276KB
morning-up-down.aiff 266KB
EMFbeat.aiff 210KB
Domino22.aiff 161KB
EMFbeat22.aiff 105KB
reconzero.aiff 98KB
MorningCorner.aiff 54KB
MorningCorner.aiff 54KB
clarinet.au 129KB
mwrap.c 23KB
rdiff_inplace.c 4KB
dftoperiod_pratio.c 4KB
rsmooth.c 3KB
dftoperiod_gen.c 3KB
dftoperiod2.c 3KB
dftoperiod.c 3KB
minparabolic.c 3KB
mininrange.c 3KB
rsum_inplace.c 3KB
interp_inplace.c 2KB
cumnorm_inplace.c 2KB
CHANGES 1KB
Inversion_Results.csv 9KB
FINDER.DAT 368B
FINDER.DAT 368B
FINDER.DAT 368B
FINDER.DAT 368B
FINDER.DAT 368B
rsum_inplace.dll 38KB
interp_inplace.dll 38KB
rdiff_inplace.dll 36KB
dftoperiod.dll 35KB
rsmooth.dll 35KB
minparabolic.dll 35KB
cumnorm_inplace.dll 35KB
mininrange.dll 34KB
dftoperiod2.dll 8KB
mwrap.h 8KB
mwrap_check.h 1KB
yin.html 3KB
INSTALL 361B
snake_demo.m 24KB
snake_demo.m 24KB
sf_info.m 13KB
AudioMorph.m 9KB
TestAutoMorph2.m 8KB
TestAutoMorph2.m 7KB
yin.m 7KB
mfccinvtest.m 6KB
BigAudioMorph.m 6KB
SyncMorph.m 6KB
SyncMorph.m 6KB
mfcc2.m 6KB
mfcc2.m 6KB
snake.m 6KB
snake.m 6KB
smc.m 5KB
sf_format.m 5KB
sf_wave.m 5KB
ICASSPCorRes.m 5KB
PQCB.m 5KB
PQavgMOVB.m 5KB
dtwmem.m 4KB
dtwmem.m 4KB
ICASSPSpecRes.m 4KB
PQevalAudio_fn.m 4KB
PQevalAudio.m 4KB
mfcc.m 4KB
ICASSPCochRes.m 4KB
InvertAndAdd.m 3KB
TestAutoMorph_jorgeh.m 3KB
dtw.m 3KB
dtw.m 3KB
yink.m 3KB
PQnNet.m 3KB
AudioMorph_jorgeh.m 3KB
FindHarmonics.m 3KB
PQadapt.m 3KB
PQeval.m 3KB
PQmovEHS.m 3KB
am.m 3KB
AudioMorph.m 2KB
LyonTest.m 2KB
SpectrumInversion.m 2KB
PQdataBoundary.m 2KB
MakeKathleenTest.m 2KB
共 343 条
- 1
- 2
- 3
- 4
资源评论
AbelZ_01
- 粉丝: 896
- 资源: 5441
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功