Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /examples/util/util.h
ViewVC logotype

Annotation of /examples/util/util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download) (as text)

1 : jhr 1884 /*! \file util.h
2 :     *
3 :     * \brief This file contains miscellaneous definitions used in the program.
4 :     *
5 :     * \author John Reppy
6 :     */
7 :    
8 :     /*
9 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
10 :     *
11 :     * COPYRIGHT (c) 2015 The University of Chicago
12 : jhr 1884 * All rights reserved.
13 :     */
14 :    
15 :     #ifndef _UTIL_H_
16 :     #define _UTIL_H_
17 :    
18 :     /* incude standard headers */
19 :     #include <stdlib.h>
20 :     #include <stdint.h>
21 :     #include <stdbool.h>
22 :     #include <assert.h>
23 :    
24 :     /* include useful teem headers */
25 :     #include "teem/air.h"
26 :     #include "teem/nrrd.h"
27 :     #include "teem/biff.h"
28 :    
29 :     /*! \brief allocate heap memory checking for failure.
30 :     * \param nbytes the amount of memory to allocate in bytes.
31 :     * \returns the allocated object.
32 :     */
33 :     extern void *CheckMalloc (size_t nbytes);
34 :    
35 :     static inline void Free (void *p) { if (p != 0) free(p); }
36 :    
37 :     #define NEW(ty) (ty *)CheckMalloc(sizeof(ty))
38 :     #define NEWVEC(ty, n) (ty *)CheckMalloc(sizeof(ty)*(n))
39 :     #define FREE(p) Free(p)
40 :    
41 :     #endif /* !_UTIL_H_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0