/matlab/cstruct/MatlabCStruct.h

http://github.com/Yniold/liftsrc · C Header · 28 lines · 14 code · 7 blank · 7 comment · 0 complexity · 5a9f7e81c42faee590313a38d4dd28b1 MD5 · raw file

  1. //--------------------------------------------------------------
  2. // file: MatlabCStruct.h - Include file for MatlabCStruct.c
  3. //--------------------------------------------------------------
  4. //--------------------------------------------------------------
  5. // ELEMENT_ATTRIBUTES
  6. //--------------------------------------------------------------
  7. typedef struct
  8. {
  9. int ElementSize; // Number of bytes required for storage of a single element in a Matlab array
  10. int ElementCount; // Number of elements in array
  11. int StorageSize; // Number of bytes required for storage of a single element in a C Structure
  12. int Alignment; // 1, 2, 4, or 8 denoting required byte alignment for this structure.
  13. } ELEMENT_ATTRIBUTES;
  14. extern int MatlabCStruct_DebugFlag;
  15. // Function prototypes
  16. ELEMENT_ATTRIBUTES MatlabCStruct(const mxArray *pArray, int MemoryAlignment, int NestLevel,
  17. unsigned char *pDataDest, unsigned char *pDataSource,
  18. int SwapFlag);
  19. char *ClassIDText(const mxArray *pArray);
  20. void SwapBytes(char *p0, int size, int count);
  21. #define SWAP(x) SwapBytes(&(x), sizeof(x))