pydim_utils.cpp File Reference

(Revision 63, commited at 2008-09-09)

#include <Python.h>
#include "structmember.h"
#include <cstdlib>
#include <cstdio>

Go to the source code of this file.

Defines

#define _DIM_CHAR_LEN   1
#define _DIM_DOUBLE   2
#define _DIM_DOUBLE_LEN   sizeof(double)
#define _DIM_FLOAT   1
#define _DIM_FLOAT_LEN   sizeof(float)
#define _DIM_INT   0
#define _DIM_INT_LEN   sizeof(int)
#define _DIM_LONG   6
#define _DIM_LONG_LEN   sizeof(long)
#define _DIM_SHORT   5
#define _DIM_SHORT_LEN   sizeof(short)
#define _DIM_STRING   4
#define _DIM_XTRA   3
#define _DIM_XTRA_LEN   sizeof(long long)
#define debug()
#define debugPyObject()
#define errmsg(x)   do { fprintf(stderr, "%s: %s\n", __FUNCTION__, x); } while(0);
#define HOST_NAME_MAX   _POSIX_HOST_NAME_MAX
#define MUL_INFINITE   -1
#define print()   printf("DIM Wrapper: %s:%u ::%s: ", __FILE__, __LINE__, __FUNCTION__); printf(__VA_ARGS__); printf("\n");
 Utility functions to used for creating the PyDim module. These are used primarily for converting between DIM C buffers and python objects.
#define Py_RETURN_NONE   do { Py_INCREF(Py_None); return Py_None; } while(0);

Functions

static PyObject * dim_buf_to_list (const char *schema, const char *buf, unsigned int len)
static PyObject * dim_buf_to_tuple (const char *schema, const char *buf, int len)
static unsigned int getElemNrFromFormat (const char *format)
static int getSizeFromFormat (const char *format)
static unsigned int getSizeFromFormatAndObjects (PyObject *iter, const char *format)
static int iterator_to_allocated_buffer (PyObject *iter, const char *format, char **buffer, unsigned int *size)
static int iterator_to_buffer (PyObject *iter, char *buffer, unsigned int size, const char *format)
static int listOrTuple2Int (PyObject *pyObj, int **buffer)
static int next_element (const char *schema, unsigned int *p, int *type, int *mult)
static PyObject * pyCallFunction (PyObject *pyFunc, PyObject *args)
static PyObject * stringList_to_tuple (char *services)
static int verify_dim_format (const char *format)


Define Documentation

#define _DIM_CHAR_LEN   1

Definition at line 68 of file pydim_utils.cpp.

#define _DIM_DOUBLE   2

Definition at line 61 of file pydim_utils.cpp.

#define _DIM_DOUBLE_LEN   sizeof(double)

Definition at line 62 of file pydim_utils.cpp.

#define _DIM_FLOAT   1

Definition at line 58 of file pydim_utils.cpp.

#define _DIM_FLOAT_LEN   sizeof(float)

Definition at line 59 of file pydim_utils.cpp.

#define _DIM_INT   0

Definition at line 55 of file pydim_utils.cpp.

#define _DIM_INT_LEN   sizeof(int)

Definition at line 56 of file pydim_utils.cpp.

#define _DIM_LONG   6

Definition at line 73 of file pydim_utils.cpp.

#define _DIM_LONG_LEN   sizeof(long)

Definition at line 74 of file pydim_utils.cpp.

#define _DIM_SHORT   5

Definition at line 70 of file pydim_utils.cpp.

#define _DIM_SHORT_LEN   sizeof(short)

Definition at line 71 of file pydim_utils.cpp.

#define _DIM_STRING   4

Definition at line 67 of file pydim_utils.cpp.

#define _DIM_XTRA   3

Definition at line 64 of file pydim_utils.cpp.

#define _DIM_XTRA_LEN   sizeof(long long)

Definition at line 65 of file pydim_utils.cpp.

 
#define debug (  ) 

Definition at line 42 of file pydim_utils.cpp.

 
#define debugPyObject (  ) 

Definition at line 43 of file pydim_utils.cpp.

#define errmsg (  )     do { fprintf(stderr, "%s: %s\n", __FUNCTION__, x); } while(0);

Definition at line 53 of file pydim_utils.cpp.

#define HOST_NAME_MAX   _POSIX_HOST_NAME_MAX

Definition at line 47 of file pydim_utils.cpp.

#define MUL_INFINITE   -1

Definition at line 76 of file pydim_utils.cpp.

 
#define print (  )     printf("DIM Wrapper: %s:%u ::%s: ", __FILE__, __LINE__, __FUNCTION__); printf(__VA_ARGS__); printf("\n");

Utility functions to used for creating the PyDim module. These are used primarily for converting between DIM C buffers and python objects.

**************************************************************************

Authors:
M. Frank, N. Neufeld, R. Stoica
Date:
Nov. 2007 - September 2008
Various defines necessary for converting between the dim buffers and Python objects.

TODO: All the tests until were done communicating between the same architectures (32 bits and 64 bits). Not sure DIM supports communicating between platforms that have different sizes for the basic types. Anyway I can't fix this if DIM doesn't support this.

Definition at line 35 of file pydim_utils.cpp.

#define Py_RETURN_NONE   do { Py_INCREF(Py_None); return Py_None; } while(0);

Definition at line 51 of file pydim_utils.cpp.


Function Documentation

static PyObject* dim_buf_to_list ( const char *  schema,
const char *  buf,
unsigned int  len 
) [static]

Definition at line 304 of file pydim_utils.cpp.

static PyObject* dim_buf_to_tuple ( const char *  schema,
const char *  buf,
int  len 
) [static]

Definition at line 438 of file pydim_utils.cpp.

static unsigned int getElemNrFromFormat ( const char *  format  )  [static]

Definition at line 487 of file pydim_utils.cpp.

static int getSizeFromFormat ( const char *  format  )  [static]

Definition at line 456 of file pydim_utils.cpp.

static unsigned int getSizeFromFormatAndObjects ( PyObject *  iter,
const char *  format 
) [static]

Definition at line 524 of file pydim_utils.cpp.

static int iterator_to_allocated_buffer ( PyObject *  iter,
const char *  format,
char **  buffer,
unsigned int *  size 
) [static]

Definition at line 765 of file pydim_utils.cpp.

static int iterator_to_buffer ( PyObject *  iter,
char *  buffer,
unsigned int  size,
const char *  format 
) [static]

Definition at line 602 of file pydim_utils.cpp.

static int listOrTuple2Int ( PyObject *  pyObj,
int **  buffer 
) [static]

Definition at line 87 of file pydim_utils.cpp.

static int next_element ( const char *  schema,
unsigned int *  p,
int *  type,
int *  mult 
) [static]

Definition at line 248 of file pydim_utils.cpp.

static PyObject* pyCallFunction ( PyObject *  pyFunc,
PyObject *  args 
) [static]

Definition at line 163 of file pydim_utils.cpp.

static PyObject* stringList_to_tuple ( char *  services  )  [static]

Definition at line 134 of file pydim_utils.cpp.

static int verify_dim_format ( const char *  format  )  [static]

Definition at line 197 of file pydim_utils.cpp.


Generated on 5 Feb 2014 for PyDIM by  doxygen 1.4.7