1 /* ====================================================================
2 * Copyright (c) 1999-2001 Carnegie Mellon University. All rights
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
18 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
19 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
22 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * ====================================================================
36 * **********************************************
37 * CMU ARPA Speech Project
39 * Copyright (c) 1989 Carnegie Mellon University.
40 * ALL RIGHTS RESERVED.
41 * **********************************************
43 *------------------------------------------------------------*
45 * CMPSL macros to make error handling a little easier.
46 *------------------------------------------------------------*
49 * $Log: CM_macros.h,v $
50 * Revision 1.5 2004/12/10 16:48:55 rkm
51 * Added continuous density acoustic model handling
54 * Spring 89, Fil Alleva (faa) Carnegie Mellon
63 *------------------------------------------------------------*
65 #define CM_fopen(name,mode) _CM_fopen((name),(mode),__FILE__,__LINE__)
68 *------------------------------------------------------------*
70 #define CM_fopenp(dirl,name,mode) _CM_fopenp((dirl),(name),(mode),__FILE__,__LINE__)
74 *------------------------------------------------------------*
76 #define CM_fread(ptr,size,cnt,stream) \
79 if (fread(ptr,size,cnt,stream) != cnt) { \
80 sprintf (mesg, "%s(%d): fread failed", \
81 __FILE__, __LINE__); \
89 *------------------------------------------------------------*
91 #define CM_calloc(cnt,size) _CM_calloc((cnt),(size),__FILE__,__LINE__)
95 *------------------------------------------------------------*
97 #define CM_2dcalloc(rcnt,ccnt,size) _CM_2dcalloc((rcnt),(ccnt),(size),__FILE__,__LINE__)
101 *------------------------------------------------------------*
103 #define CM_3dcalloc(lcnt,rcnt,ccnt,size) \
104 _CM_3dcalloc((lcnt),(rcnt),(ccnt),(size),__FILE__,__LINE__)
108 *------------------------------------------------------------*
110 #define CM_recalloc(ptr,cnt,size) _CM_recalloc((ptr),(cnt),(size),__FILE__,__LINE__)
113 extern FILE *_CM_fopen(char const *file
, char const *mode
,
114 char const *srcfile
, int32 srcline
);
115 extern FILE *_CM_fopenp(char const *dirl
, char const *file
,
116 char const *mode
, char const *srcfile
,
118 extern void *_CM_calloc(int32 cnt
, int32 size
, char const *file
, int32 line
);
119 extern void *_CM_2dcalloc(int32 rcnt
, int32 ccnt
, int32 size
, char const *srcfile
, int32 srcline
);
120 extern void *_CM_3dcalloc(int32 lcnt
, int32 rcnt
, int32 ccnt
, int32 size
,
121 char const *srcfile
, int32 srcline
);
122 extern void *_CM_recalloc(void *ptr
, int32 cnt
, int32 size
,
123 char const *srcfile
, int32 srcline
);
125 #endif /* _CM_MACROS_H_ */