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

SCM Repository

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

View of /examples/util/util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1884 - (download) (as text) (annotate)
Sun May 20 15:07:04 2012 UTC (7 years ago) by jhr
File size: 901 byte(s)
  Working on demos
/*! \file util.h
 *
 * \brief This file contains miscellaneous definitions used in the program.
 *
 * \author John Reppy
 */

/*
 * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */

#ifndef _UTIL_H_
#define _UTIL_H_

/* incude standard headers */
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>

/* include useful teem headers */
#include "teem/air.h"
#include "teem/nrrd.h"
#include "teem/biff.h"

/*! \brief allocate heap memory checking for failure.
 *  \param nbytes the amount of memory to allocate in bytes.
 *  \returns the allocated object.
 */
extern void *CheckMalloc (size_t nbytes);

static inline void Free (void *p) { if (p != 0) free(p); }

#define NEW(ty)		(ty *)CheckMalloc(sizeof(ty))
#define NEWVEC(ty, n)	(ty *)CheckMalloc(sizeof(ty)*(n))
#define FREE(p)		Free(p)

#endif /* !_UTIL_H_ */

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