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

SCM Repository

[diderot] View of /branches/vis15/src/lib/common/util.cxx
ViewVC logotype

View of /branches/vis15/src/lib/common/util.cxx

Parent Directory Parent Directory | Revision Log Revision Log

Revision 3825 - (download) (as text) (annotate)
Thu May 5 16:23:54 2016 UTC (3 years, 2 months ago) by jhr
File size: 1069 byte(s)
working on merge: runtime
/*! \file util.cxx
 * \author John Reppy

 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.

#include <cstdlib>
#include "diderot/image.hxx"
#include "teem/biff.h"

namespace Diderot {

Nrrd *load_nrrd_file (struct WorldBase *wrld, std::string const &filename)
  /* create a nrrd; at this point it is just an empty container */
    Nrrd *nin = nrrdNew();

  /* read in the nrrd from the file */
    if (nrrdLoad(nin, filename.c_str(), nullptr) != nullptr) {
	char *msg = biffGetDone(NRRD);
        biffMsgAdd (wrld->_errors, msg);
	free (msg);
        return nullptr;

    return nin;


void error (struct WorldBase *wrld, const char *fmt, ...)
    char buf[1024];
    va_list ap;

// NOTE: if there was a biffMsg function that worked with va_lists, then we
// could avoid the buffer
    va_start (ap, fmt);
    vsnprintf (buf, sizeof(buf), fmt, ap);
    va_end (ap);

    biffMsgAdd (wrld->errors, buf);

} // namespace Diderot

ViewVC Help
Powered by ViewVC 1.0.0