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

SCM Repository

[diderot] View of /trunk/src/lib/diderot.h
ViewVC logotype

View of /trunk/src/lib/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 440 - (download) (as text) (annotate)
Wed Oct 20 03:20:16 2010 UTC (8 years, 8 months ago) by jhr
File size: 2288 byte(s)
  More runtime work
/*! \file diderot.h
 *
 * \author John Reppy
 */

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

#ifndef _DIDEROT_H_
#define _DIDEROT_H_

#define STATIC_INLINE	static inline

#include <stdint.h>
#include <stdbool.h>

/* library-call status */
typedef enum { DIDEROT_OK = 0, DIDEROT_FAIL = -1 } Status_t;

/* SSE vector types */
typedef float float4 __attribute__ ((__vector_size__ (16)));
typedef double double2 __attribute__ ((__vector_size__ (16)));

/* union types for converting extracting vector data */
typedef union {
    float	f[4];
    float4	v;
} f4union;

typedef union {
    double	d[2];
    double2	v;
} d2union;

/* typedefs for Diderot types */
typedef int32_t Diderot_int_t;
typedef float Diderot_real_t;
typedef f4union Diderot_vec3_t;	// padded to fit in SSE register
typedef f4union Diderot_vec4_t;
typedef const char *Diderot_string_t;

typedef struct {		// wrapper for 1D image data
    uint32_t	dim;		// dimension (== 1)
    uint32_t	size[1];
    void	*data;
} Diderot_image1D_t;

typedef struct {		// wrapper for 2D image data
    uint32_t	dim;		// dimension (== 2)
    uint32_t	size[2];	// sizes (fast to slow)
    void	*data;
} Diderot_image2D_t;

typedef struct {		// wrapper for 3D image data
    uint32_t	dim;		// dimension (== 3)
    uint32_t	size[3];	// sizes (fast to slow)
    void	*data;
} Diderot_image3D_t;

/* Diderot library functions */

/* load image data from Nrrd files */
extern Status_t Diderot_LoadImage1D (Diderot_string_t name, Diderot_image1D_t *img);
extern Status_t Diderot_LoadImage2D (Diderot_string_t name, Diderot_image2D_t *img);
extern Status_t Diderot_LoadImage3D (Diderot_string_t name, Diderot_image3D_t *img);

/* functions to get input-parameter values */
extern Status_t Diderot_InputString (const char *, const char **, bool);
extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool);
extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *v);

/* inline vector arithmetic functions */
STATIC_INLINE void Diderot_ScaleV3 (Diderot_vec3_t dstV, Diderot_real_t s, Diderot_vec3_t v)
{
    
}

STATIC_INLINE void Diderot_CopyV3 (&pos, &(glob->pos))
{
}

STATIC_INLINE void Diderot_AddV3 (&pos, &pos, &_t)
{
}

#endif /* !_DIDEROT_H_ */

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