home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / formats / hdf / hdfs.apb < prev    next >
Text File  |  1980-02-04  |  14KB  |  447 lines

  1.  
  2.  
  3. Appendix  B    Header Files
  4.  
  5.  
  6.  
  7.  
  8. Overview
  9.  
  10. This appendix includes the general header files used in compiling 
  11. all HDF libraries. These files do not  have to be included with most 
  12. applications, but they could be usefully added to code that refers to 
  13. specific tags by name, or code that is designed to be responsive to 
  14. different error conditions. You get these files when you get the 
  15. HDF source code.
  16.  
  17. You will see that the C header (df.h) shown in Figure B.2 is more 
  18. completely commented than the FORTRAN header (dfF.h) shown 
  19. in Figure B.1. So you may want to look at the C header for 
  20. explanations of some definitions, even if you plan to use the 
  21. #define statements from the FORTRAN header.
  22.  
  23. Other headers used for specific applications, such as the RIS 
  24. interface and the SDS interface can be found by obtaining the 
  25. source code from NCSA. They also do not normally have to be 
  26. included with your source code.
  27.  
  28.  
  29.  
  30. Figure B.1  FORTRAN Header File: dfF.h
  31.  
  32. /*****************************************************************************
  33. *                              NCSA HDF version 2.0
  34. *                                December 20, 1988
  35. *
  36. * NCSA HDF Version 2.0 source code and documentation are in the public domain.
  37. * Specifically, we give to the public domain all rights for future licensing
  38. * of the source code, all resale rights, and all publishing rights.
  39. * We ask, but do not require, that the following message be included in all
  40. * derived works:
  41. * Portions developed at the National Center for Supercomputing Applications at
  42. * the University of Illinois at Urbana-Champaign.
  43. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  44. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  45. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  46. *****************************************************************************/
  47.  
  48. C *-----------------------------------------------------------------------------
  49. C * File:     dfF.h
  50. C * Purpose:    Fortran header file for HDF routines
  51. C * Contents: 
  52. C *    Tag definitions
  53. C * Error return codes
  54. C *    Logical constants
  55. C * Remarks: This file can be included with user programs
  56. C *----------------------------------------------------------------------------*
  57.  
  58. #ifndef DFTAG_NULL
  59.  
  60. #define    DFREF_WILDCARD 0
  61.  
  62. #define    DFTAG_WILDCARD 0
  63. #define    DFTAG_NULL    1
  64.  
  65. #define    DFTAG_FID    100
  66. #define    DFTAG_FD    101
  67. #define    DFTAG_TID    102
  68. #define    DFTAG_TD    103
  69. #define    DFTAG_DIL    104
  70. #define    DFTAG_DIA    105
  71. #define    DFTAG_NT    106
  72. #define    DFTAG_MT    107
  73.  
  74. #define    DFTAG_ID8    200
  75. #define    DFTAG_IP8    201
  76. #define    DFTAG_RI8    202
  77. #define    DFTAG_CI8    203
  78. #define    DFTAG_II8    204
  79.  
  80. #define    DFTAG_ID    300
  81. #define    DFTAG_LUT    301
  82. #define    DFTAG_RI    302
  83. #define    DFTAG_CI    303
  84.  
  85. #define    DFTAG_RIG    306
  86. #define    DFTAG_LD    307
  87. #define    DFTAG_MD    308
  88. #define    DFTAG_MA    309
  89.  
  90. Figure B.1  FORTRAN Header File: dfF.h (Continued)
  91.  
  92. #define    DFTAG_CCN    310
  93. #define    DFTAG_CFM    311
  94. #define    DFTAG_AR    312
  95.  
  96. #define    DFTAG_DRAW    400
  97. #define    DFTAG_RUN    401
  98.  
  99. #define    DFTAG_XYP    500
  100. #define    DFTAG_MTO    501
  101.  
  102. #define    DFTAG_T14    602
  103. #define    DFTAG_T105    603
  104.  
  105. #define    DFTAG_RLE    11
  106. #define    DFTAG_IMCOMP 12
  107.  
  108. C                     Error Return Codes 
  109.  
  110. #define    DFE_NOERROR    0
  111. #define    DFE_FNF    -1
  112. #define    DFE_DENIED    -2
  113. #define    DFE_ALROPEN    -3
  114. #define    DFE_TOOMANY    -4
  115. #define    DFE_BADNAME    -5
  116. #define    DFE_BADACC    -6 
  117. #define    DFE_NOTOPEN    -8
  118. #define    DFE_CANTCLOSE    -9    
  119. #define    DFE_DFNULL    -10    
  120. #define    DFE_ILLTYPE    -11    
  121. #define    DFE_UNSUPPORTED    -12
  122. #define    DFE_BADDDLIST        -13
  123. #define    DFE_NOTDFFILE        -14
  124. #define    DFE_SEEDTWICE        -15
  125. #define    DFE_NOSPACE        -16
  126. #define    DFE_READERROR        -18
  127. #define    DFE_WRITEERROR    -19
  128. #define    DFE_SEEKERROR        -20
  129. #define    DFE_NOFREEDD        -21
  130. #define    DFE_BADTAG        -22
  131. #define    DFE_BADREF        -23
  132. #define    DFE_RDONLY        -24
  133. #define    DFE_BADCALL        -25
  134. #define    DFE_BADPTR        -26
  135. #define    DFE_BADLEN        -27
  136. #define    DFE_BADSEEK        -28
  137. #define    DFE_NOMATCH        -29
  138. #define    DFE_NOTINSET        -30
  139. #define    DFE_BADDIM        -31
  140. #define    DFE_BADOFFSET        -32
  141. #define    DFE_BADSCHEME        -33
  142. #define    DFE_NODIM        -34
  143. #define    DFE_NOTENOUGH        -35
  144.  
  145. C                        Logical Constants
  146.  
  147. #define    DFACC_READ        1
  148. #define    DFACC_WRITE        2
  149. #define    DFACC_CREATE        4
  150. #define    DFACC_ALL        7
  151.  
  152. #endif DFTAG_NULL
  153.  
  154. Figure B.2  C Header File: df.h
  155.  
  156. /*****************************************************************************
  157. *                              NCSA HDF version 2.0
  158. *                                December 20, 1988
  159. *
  160. * NCSA HDF Version 2.0 source code and documentation are in the public domain.
  161. * Specifically, we give to the public domain all rights for future licensing
  162. * of the source code, all resale rights, and all publishing rights.
  163. * We ask, but do not require, that the following message be included in all
  164. * derived works:
  165. * Portions developed at the National Center for Supercomputing Applications at
  166. * the University of Illinois at Urbana-Champaign.
  167. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  168. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  169. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  170. *****************************************************************************/
  171.  
  172. /*------------------------------------------------------------------------------
  173.  * File:     df.h
  174.  * Purpose:    header file for HDF routines
  175.  * Invokes:    dfi.h
  176.  * Contents: 
  177.  *    Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata
  178.  *    Procedure type definitions
  179.  *    Global variables
  180.  *    Tag definitions
  181.  *  Error return codes
  182.  *    Logical constants
  183.  * Remarks: This file is included with user programs
  184.  *        Since it includes stdio.h etc., do not include these after df.h
  185.  *----------------------------------------------------------------------------*/
  186.  
  187.  
  188. #ifndef DFTAG_NULL                /* avoid re-inclusion */
  189.  
  190. /* include DF (internal) header information */
  191. #include "dfi.h"
  192.  
  193. /*--------------------------------------------------------------------------*/
  194. /*Type declarations                                 */
  195.  
  196. typedef struct DFddh {        /* format of data descriptor headers as in file */
  197.     int16
  198.         dds;            /* number of dds in header block */
  199.     int32    
  200.         next;            /* offset of next header block */
  201.     } DFddh;
  202.  
  203.         
  204. typedef struct 
  205.     uint16
  206.         tag,            /* data tag */
  207.         ref;            /* data reference number */
  208.     int32
  209.         offset,        /* offset of data element in file */
  210.         length;        /* number of bytes */
  211.     } DFdd;
  212.  
  213. Figure B.2  C Header File: df.h (Continued)
  214.  
  215.     /* descriptor structure is same as dd structure.  ###Note: may be changed */
  216. #define    DFdesc    DFdd
  217.  
  218.  
  219.     /* DLE is the internal structure that stores data descriptor information */
  220.     /* It is a linked list of DDs */
  221. typedef struct DFdle {        /* Data List element */
  222.     struct DFdle
  223.         *next;            /* link to next dle */
  224.     DFddh
  225.         ddh;            /* To store headers */
  226.     DFdd
  227.         dd[1];            /* dummy size */
  228.     } DFdle;    
  229.  
  230.  
  231.     /* DF is the internal structure associated with each DF file */
  232.     /* It holds information associated with the file as a whole */
  233.     /* ### Note: there are hooks for having multiple DF files open at a time */
  234. typedef struct DF {
  235.     DFdle
  236.         *list,        /* Pointer to the DLE list */
  237.         *last_dle;    /* last_dle and last_dd are used in searches to indicate
  238.                     element returned by previous call to DFfind */
  239.     int
  240.         type,        /* 0= not in use, 1= normal, -1 = multiple */
  241.                 /* this is a hook for when multiple files are open */
  242.         access,    /* permitted access types: 0=none, 1=r, 2=w, 3=r/w */
  243.         changed,     /* True if anything in DDs modified since last write */
  244.         last_tag,    /* Last tag searched for by DFfind */
  245.         last_ref,    /* Last reference number searched for */
  246.         last_dd,    /* see last_dle */
  247.         defdds,    /* default number of DD's in each block */
  248.         up_access;    /* access permissions to element being read/updated */
  249.                 /* Used by DFstart */
  250.     DFdd
  251.         *up_dd;    /* DD of element being read/updated, used by DFstart */
  252.                   /* file handle is a file pointer or file descriptor */
  253.                 /* depending whether we use buffered or unbuffered i/o */
  254.  
  255. #ifdef DF_BUFFIO
  256.     FILE *            /* file pointer */
  257. #else DF_BUFFIO
  258.     int            /* file descriptor */
  259. #endif DF_BUFFIO
  260.         file;        /* File handle for real file */
  261. } DF;
  262.  
  263.  
  264. typedef struct DFdi {    /* data identifier: specifies data element uniquely */
  265.     uint16 tag;
  266.     uint16 ref;
  267. } DFdi;
  268.  
  269.  
  270.  
  271. typedef struct DFdata {    /* structure for returning status information */
  272.     int version;        /* version number of program */
  273. } DFdata;
  274.  
  275.  
  276. Figure B.2  C Header File: df.h (Continued)
  277.  
  278. /*--------------------------------------------------------------------------*/
  279. /*        Procedure types                         */
  280.  
  281. DF *DFopen();
  282. int32 DFgetelement();
  283. int32 DFread();
  284. int32 DFseek();
  285. int32 DFwrite();
  286.  
  287. /*--------------------------------------------------------------------------*/
  288. /*        Global Variables                         */
  289.  
  290. #ifndef DFMASTER
  291. extern
  292. #endif DFMASTER
  293. int
  294.     DFerror;            /* Error code for DF routines */
  295.  
  296. /*--------------------------------------------------------------------------*/
  297. /*        Tag Definitions                            */
  298.  
  299. #define    DFREF_WILDCARD 0    /* wildcard ref for searches */
  300.  
  301. #define    DFTAG_WILDCARD 0    /* wildcard tag for searches */
  302. #define    DFTAG_NULL    1        /* empty DD */
  303.  
  304.     /* utility set */
  305. #define    DFTAG_FID    100        /* File identifier */
  306. #define    DFTAG_FD    101        /* File description */
  307. #define    DFTAG_TID    102        /* Tag identifier */
  308. #define    DFTAG_TD    103        /* Tag descriptor */
  309. #define    DFTAG_DIL    104        /* data identifier label */
  310. #define    DFTAG_DIA    105        /* data identifier annotation */
  311. #define    DFTAG_NT    106        /* number type */
  312. #define    DFTAG_MT    107        /* machine type */
  313.  
  314.     /* raster-8 set */
  315. #define    DFTAG_ID8    200        /* 8-bit Image dimension */
  316. #define    DFTAG_IP8    201        /* 8-bit Image palette */
  317. #define    DFTAG_RI8    202        /* Raster-8 image */
  318. #define    DFTAG_CI8    203        /* RLE compressed 8-bit image */
  319. #define    DFTAG_II8    204        /* IMCOMP compressed 8-bit image */
  320.  
  321.     /* Raster Image set */
  322. #define    DFTAG_ID    300        /* Image DimRec */
  323. #define    DFTAG_LUT    301        /* Image Palette */
  324. #define    DFTAG_RI    302        /* Raster Image */
  325. #define    DFTAG_CI    303        /* Compressed Image */
  326.  
  327. #define    DFTAG_RIG    306        /* Raster Image Group */
  328. #define    DFTAG_LD    307        /* Palette DimRec */
  329. #define    DFTAG_MD    308        /* Matte DimRec */
  330. #define    DFTAG_MA    309        /* Matte Data */
  331. #define    DFTAG_CCN    310        /* color correction */
  332. #define    DFTAG_CFM    311        /* color format */
  333. #define    DFTAG_AR    312        /* aspect ratio */
  334.     
  335. #define    DFTAG_DRAW    400        /* Draw these images in sequence */
  336. #define    DFTAG_RUN    401        /* run this as a program/script */
  337.  
  338.  
  339. Figure B.2  C Header File: df.h (Continued)
  340.  
  341. #define    DFTAG_XYP    500        /* x-y position */
  342. #define    DFTAG_MTO    501        /* machine-type override */
  343.  
  344.     /* Tektronix */
  345. #define    DFTAG_T14    602        /* TEK 4014 data */
  346. #define    DFTAG_T105    603        /* TEK 4105 data */
  347.  
  348.     /* Scientific Data set */
  349. #define    DFTAG_SDG    700        /* Scientific Data Group */
  350. #define    DFTAG_SDD    701        /* Scientific Data DimRec */
  351. #define    DFTAG_SD    702        /* Scientific Data */
  352. #define    DFTAG_SDS    703        /* Scales */
  353. #define    DFTAG_SDL    704        /* Labels */
  354. #define    DFTAG_SDU    705        /* Units */
  355. #define    DFTAG_SDF    706        /* Formats */
  356. #define    DFTAG_SDM    707        /* Max/Min */
  357. #define    DFTAG_SDC    708        /* Coord sys */
  358.  
  359.     /* compression schemes */
  360. #define    DFTAG_RLE    11        /* run length encoding */
  361. #define    DFTAG_IMCOMP 12        /* IMCOMP compression */
  362.  
  363. /*--------------------------------------------------------------------------*/
  364. /*        Error Return Codes                         */
  365.  
  366. #define    DFE_NOERROR        0    /* No error */
  367. #define    DFE_FNF        -1    /* File not found error */
  368. #define    DFE_DENIED        -2    /* Access to file denied */
  369. #define    DFE_ALROPEN        -3    /* File already open */
  370. #define    DFE_TOOMANY        -4    /* Too Many DF's or files open */
  371. #define    DFE_BADNAME        -5    /* Bad file name on open */
  372. #define    DFE_BADACC        -6    /* Bad file access mode */
  373. #define    DFE_BADOPEN        -7    /* Other open error */
  374. #define    DFE_NOTOPEN        -8    /* File can't be closed: it isn't open */
  375. #define    DFE_CANTCLOSE        -9    /* fclose wouldn't work! */
  376. #define    DFE_DFNULL        -10    /* DF is a null pointer */
  377. #define    DFE_ILLTYPE        -11    /* DF has an illegal type: internal error */
  378. #define    DFE_UNSUPPORTED    -12    /* Feature not currently supported */
  379. #define    DFE_BADDDLIST        -13    /* No DD list: internal error */
  380. #define    DFE_NOTDFFILE        -14    /* Not a DF file and it is not 0 length */
  381. #define    DFE_SEEDTWICE        -15    /* DD list already seeded: internal error */
  382. #define    DFE_NOSPACE        -16    /* Malloc failed */
  383. #define    DFE_NOSUCHTAG        -17    /* No such tag in the file: search failed*/
  384. #define    DFE_READERROR        -18    /* There was a read error */
  385. #define    DFE_WRITEERROR    -19    /* There was a write error */
  386. #define    DFE_SEEKERROR        -20    /* There was a seek error */
  387. #define    DFE_NOFREEDD        -21    /* No free DD's left: internal error */
  388. #define    DFE_BADTAG        -22    /* illegal WILDCARD tag */
  389. #define    DFE_BADREF        -23    /* illegal WILDCARD reference # */
  390. #define    DFE_RDONLY        -24    /* The DF is read only */
  391. #define    DFE_BADCALL        -25    /* Calls in wrong order */
  392. #define    DFE_BADPTR        -26     /* NULL ptr argument */
  393. #define    DFE_BADLEN        -27    /* negative len specified */
  394. #define    DFE_BADSEEK        -28    /* Attempt to seek past end of element */
  395. #define    DFE_NOMATCH        -29    /* No (more) DDs which match specified tag/ref */
  396. #define    DFE_NOTINSET        -30    /* Warning: Set contained unknown tag: ignored */
  397. #define    DFE_BADDIM        -31    /* negative or zero dimensions specified */
  398. #define    DFE_BADOFFSET        -32    /* Illegal offset specified */
  399. #define    DFE_BADSCHEME        -33    /* Unknown compression scheme specified */
  400. #define    DFE_NODIM        -34    /* No dimension record associated with image */
  401. #define    DFE_NOTENOUGH        -35    /* space provided insufficient for size of data 
  402.  
  403. Figure B.2  C Header File: df.h (Continued)
  404.  
  405. */
  406. #define    DFE_NOVALS        -36    /* Values not available */
  407. #define    DFE_CORRUPT        -37    /* File is corrupted */
  408. #define    DFE_BADCONV        -37    /* Don't know how to convert data type */
  409. #define    DFE_BADFP        -38    /* The file contained an illegal floating point 
  410. no*/
  411.  
  412. /*--------------------------------------------------------------------------*/
  413. /*        Logical Constants                         */
  414.  
  415. #define    DFACC_READ        1    /* Read Access */
  416. #define    DFACC_WRITE        2    /* Write Access */
  417. #define    DFACC_CREATE        4    /* force file to be created */
  418. #define    DFACC_ALL        7    /* logical and of all the above values */
  419.  
  420. #endif DFTAG_NULL
  421.  
  422.  
  423. B.1    NCSA HDF Specifications
  424.  
  425. Header Files    B.1
  426.  
  427. National Center for Supercomputing Applications
  428.  
  429. March 1989
  430.  
  431.                                                                 
  432.  
  433. February 1989
  434.  
  435.  
  436.