dapalign.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*********************************************************************
  2. * Copyright 1993, UCAR/Unidata
  3. * See netcdf/COPYRIGHT file for copying and redistribution conditions.
  4. * $Header: /upc/share/CVS/netcdf-3/libncdap3/dapalign.h,v 1.3 2009/09/23 22:26:00 dmh Exp $
  5. *********************************************************************/
  6. #ifndef ALIGN_H
  7. #define ALIGN_H 1
  8. typedef struct NCtypealignment {
  9. char* typename;
  10. int alignment;
  11. } NCtypealignment;
  12. /* Define indices for every primitive C type */
  13. /* NAT => NOT-A-TYPE*/
  14. #define NCCTYPENAT 0
  15. #define NCCTYPECHAR 1
  16. #define NCCTYPEUCHAR 2
  17. #define NCCTYPESHORT 3
  18. #define NCCTYPEUSHORT 4
  19. #define NCCTYPEINT 5
  20. #define NCCTYPEUINT 6
  21. #define NCCTYPELONG 7
  22. #define NCCTYPEULONG 8
  23. #define NCCTYPELONGLONG 9
  24. #define NCCTYPEULONGLONG 10
  25. #define NCCTYPEFLOAT 11
  26. #define NCCTYPEDOUBLE 12
  27. #define NCCTYPEPTR 13
  28. #define NCCTYPENCVLEN 14
  29. /* Capture in struct and in a vector*/
  30. typedef struct NCtypealignset {
  31. NCtypealignment charalign; /* char*/
  32. NCtypealignment ucharalign; /* unsigned char*/
  33. NCtypealignment shortalign; /* short*/
  34. NCtypealignment ushortalign; /* unsigned short*/
  35. NCtypealignment intalign; /* int*/
  36. NCtypealignment uintalign; /* unsigned int*/
  37. NCtypealignment longalign; /* long*/
  38. NCtypealignment ulongalign; /* unsigned long*/
  39. NCtypealignment longlongalign; /* long long*/
  40. NCtypealignment ulonglongalign; /* unsigned long long*/
  41. NCtypealignment floatalign; /* float*/
  42. NCtypealignment doublealign; /* double*/
  43. NCtypealignment ptralign; /* void**/
  44. NCtypealignment ncvlenalign; /* nc_vlen_t*/
  45. } NCtypealignset;
  46. typedef NCtypealignment NCtypealignvec;
  47. extern void compute_nccalignments(void);
  48. extern unsigned int ncctypealignment(int nctype);
  49. extern int nccpadding(unsigned long offset, int alignment);
  50. #endif /*ALIGN_H*/