home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / graphics.formats / hdf / NCSA_HDF / HDF.Appendix.B.ascii.Z / HDF.Appendix.B.ascii
Encoding:
Text File  |  1991-09-24  |  12.8 KB  |  435 lines

  1. B.1NCSA HDF Calling Interfaces and Utilities
  2.  
  3. Header FilesB.1
  4.  
  5. National Center for Supercomputing Applications
  6.  
  7. November 1989
  8.  
  9.  
  10.  
  11. November 1989
  12.  
  13.  
  14.  
  15.  
  16. Appendix  BHeader Files
  17.  
  18.  
  19.  
  20.  
  21. This appendix includes the general header files used in compiling all HDF libraries. These files do not have to be included with most applications, but they could be usefully added to code that refers to specific tags by name, or code that is designed to be responsive to different error conditions. You get these files when you get the HDF source code.
  22.  
  23. You will see that the C header (df.h) shown in Figure B.2 is more completely commented than the FORTRAN header () shown in Figure B.1. Thus, you may want to look at the C header for explanations of some definitions, even if you plan to use the #define statements from the FORTRAN header.
  24.  
  25. Other headers used for specific applications, such as the RIS interface and the SDS interface can be found by obtaining the source code from NCSA. These headers also do not normally have to be included with your source code.
  26.  
  27.  
  28.  
  29. Figure B.1  FORTRAN Header File: dfF.h
  30.  
  31. /*****************************************************************************
  32. *  NCSA HDF version 2.0
  33. *December 20, 1988
  34. *
  35. * NCSA HDF Version 2.0 source code and documentation are in the public domain.
  36. * Specifically, we give to the public domain all rights for future licensing
  37. * of the source code, all resale rights, and all publishing rights.
  38. * We ask, but do not require, that the following message be included in all
  39. * derived works:
  40. * Portions developed at the National Center for Supercomputing Applications at
  41. * the University of Illinois at Urbana-Champaign.
  42. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  43. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  44. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  45. *****************************************************************************/
  46.  
  47. C *-----------------------------------------------------------------------------
  48. C * File: dfF.h
  49. C * Purpose:Fortran header file for HDF routines
  50. C * Contents: 
  51. C *Tag definitions
  52. C * Error return codes
  53. C *Logical constants
  54. C * Remarks: This file can be included with user programs
  55. C *----------------------------------------------------------------------------*
  56.  
  57. #ifndef DFTAG_NULL
  58.  
  59. #defineDFREF_WILDCARD 0
  60. #defineDFTAG_WILDCARD 0
  61. #defineDFTAG_NULL1
  62.  
  63. #defineDFTAG_FID100
  64. #defineDFTAG_FD101
  65. #defineDFTAG_TID102
  66. #defineDFTAG_TD103
  67. #defineDFTAG_DIL104
  68. #defineDFTAG_DIA105
  69. #defineDFTAG_NT106
  70. #defineDFTAG_MT107
  71.  
  72. #defineDFTAG_ID8200
  73. #defineDFTAG_IP8201
  74. #defineDFTAG_RI8202
  75. #defineDFTAG_CI8203
  76. #defineDFTAG_II8204
  77.  
  78. #defineDFTAG_ID300
  79. #defineDFTAG_LUT301
  80. #defineDFTAG_RI302
  81. #defineDFTAG_CI303
  82.  
  83. #defineDFTAG_RIG306
  84. #defineDFTAG_LD307
  85. #defineDFTAG_MD308
  86. #defineDFTAG_MA309
  87.  
  88.  
  89. Figure B.1  FORTRAN Header File: dfF.h (Continued)
  90.  
  91. #defineDFTAG_CCN310
  92. #defineDFTAG_CFM311
  93. #defineDFTAG_AR312
  94.  
  95. #defineDFTAG_DRAW400
  96. #defineDFTAG_RUN401
  97.  
  98. #defineDFTAG_XYP500
  99. #defineDFTAG_MTO501
  100.  
  101. #defineDFTAG_T14602
  102. #defineDFTAG_T105603
  103.  
  104. #defineDFTAG_RLE11
  105. #defineDFTAG_IMCOMP 12
  106.  
  107. C Error Return Codes 
  108.  
  109. #defineDFE_NOERROR0
  110. #defineDFE_FNF-1
  111. #defineDFE_DENIED-2
  112. #defineDFE_ALROPEN-3
  113. #defineDFE_TOOMANY-4
  114. #defineDFE_BADNAME-5
  115. #defineDFE_BADACC-6 
  116. #defineDFE_NOTOPEN-8
  117. #defineDFE_CANTCLOSE-9
  118. #defineDFE_DFNULL-10
  119. #defineDFE_ILLTYPE-11
  120. #defineDFE_UNSUPPORTED-12
  121. #defineDFE_BADDDLIST-13
  122. #defineDFE_NOTDFFILE-14
  123. #defineDFE_SEEDTWICE-15
  124. #defineDFE_NOSPACE-16
  125. #defineDFE_READERROR-18
  126. #defineDFE_WRITEERROR-19
  127. #defineDFE_SEEKERROR-20
  128. #defineDFE_NOFREEDD-21
  129. #defineDFE_BADTAG-22
  130. #defineDFE_BADREF-23
  131. #defineDFE_RDONLY-24
  132. #defineDFE_BADCALL-25
  133. #defineDFE_BADPTR-26
  134. #defineDFE_BADLEN-27
  135. #defineDFE_BADSEEK-28
  136. #defineDFE_NOMATCH-29
  137. #defineDFE_NOTINSET-30
  138. #defineDFE_BADDIM-31
  139. #defineDFE_BADOFFSET-32
  140. #defineDFE_BADSCHEME-33
  141. #defineDFE_NODIM-34
  142. #defineDFE_NOTENOUGH-35
  143.  
  144. CLogical Constants
  145.  
  146. #defineDFACC_READ1
  147. #defineDFACC_WRITE2
  148. #defineDFACC_CREATE4
  149. #defineDFACC_ALL7
  150.  
  151. #endif DFTAG_NULL
  152.  
  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 strucdure is same as dd structure.  ###Note: may be changed */
  216. #defineDFdescDFdd
  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. #defineDFREF_WILDCARD 0/* wildcard ref for searches */
  300.  
  301. #defineDFTAG_WILDCARD 0/* wildcard tag for searches */
  302. #defineDFTAG_NULL1/* empty DD */
  303.  
  304. /* utility set */
  305. #defineDFTAG_FID100/* File identifier */
  306. #defineDFTAG_FD101/* File description */
  307. #defineDFTAG_TID102/* Tag identifier */
  308. #defineDFTAG_TD103/* Tag descriptor */
  309. #defineDFTAG_DIL104/* data identifier label */
  310. #defineDFTAG_DIA105/* data identifier annotation */
  311. #defineDFTAG_NT106/* number type */
  312. #defineDFTAG_MT107/* machine type */
  313.  
  314. /* raster-8 set */
  315. #defineDFTAG_ID8200/* 8-bit Image dimension */
  316. #defineDFTAG_IP8201/* 8-bit Image palette */
  317. #defineDFTAG_RI8202/* Raster-8 image */
  318. #defineDFTAG_CI8203/* RLE compressed 8-bit image */
  319. #defineDFTAG_II8204/* IMCOMP compressed 8-bit image */
  320.  
  321. /* Raster Image set */
  322. #defineDFTAG_ID300/* Image DimRec */
  323. #defineDFTAG_LUT301/* Image Palette */
  324. #defineDFTAG_RI302/* Raster Image */
  325. #defineDFTAG_CI303/* Compressed Image */
  326.  
  327. #defineDFTAG_RIG306/* Raster Image Group */
  328. #defineDFTAG_LD307/* Palette DimRec */
  329. #defineDFTAG_MD308/* Matte DimRec */
  330. #defineDFTAG_MA309/* Matte Data */
  331. #defineDFTAG_CCN310/* color correction */
  332. #defineDFTAG_CFM311/* color format */
  333. #defineDFTAG_AR312/* aspect ratio */
  334.  
  335. #defineDFTAG_DRAW400/* Draw these images in sequence */
  336. #defineDFTAG_RUN401/* run this as a program/script */
  337.  
  338.  
  339. Figure B.2  C Header File: df.h (Continued)
  340.  
  341. #defineDFTAG_XYP500/* x-y position */
  342. #defineDFTAG_MTO501/* machine-type override */
  343.  
  344. /* Tektronix */
  345. #defineDFTAG_T14602/* TEK 4014 data */
  346. #defineDFTAG_T105603/* TEK 4105 data */
  347.  
  348. /* Scientific Data set */
  349. #defineDFTAG_SDG700/* Scientific Data Group */
  350. #defineDFTAG_SDD701/* Scientific Data DimRec */
  351. #defineDFTAG_SD702/* Scientific Data */
  352. #defineDFTAG_SDS703/* Scales */
  353. #defineDFTAG_SDL704/* Labels */
  354. #defineDFTAG_SDU705/* Units */
  355. #defineDFTAG_SDF706/* Formats */
  356. #defineDFTAG_SDM707/* Max/Min */
  357. #defineDFTAG_SDC708/* Coord sys */
  358.  
  359. /* compression schemes */
  360. #defineDFTAG_RLE11/* run length encoding */
  361. #defineDFTAG_IMCOMP 12/* IMCOMP compression */
  362.  
  363. /*--------------------------------------------------------------------------*/
  364. /*Error Return Codes */
  365.  
  366. #defineDFE_NOERROR0/* No error */
  367. #defineDFE_FNF-1/* File not found error */
  368. #defineDFE_DENIED-2/* Access to file denied */
  369. #defineDFE_ALROPEN-3/* File already open */
  370. #defineDFE_TOOMANY-4/* Too Many DF's or files open */
  371. #defineDFE_BADNAME-5/* Bad file name on open */
  372. #defineDFE_BADACC-6/* Bad file access mode */
  373. #defineDFE_BADOPEN-7/* Other open error */
  374. #defineDFE_NOTOPEN-8/* File can't be closed: it isn't open */
  375. #defineDFE_CANTCLOSE-9/* fclose wouldn't work! */
  376. #defineDFE_DFNULL-10/* DF is a null pointer */
  377. #defineDFE_ILLTYPE-11/* DF has an illegal type: internal error */
  378. #defineDFE_UNSUPPORTED-12/* Feature not currently supported */
  379. #defineDFE_BADDDLIST-13/* No DD list: internal error */
  380. #defineDFE_NOTDFFILE-14/* Not a DF file and it is not 0 length */
  381. #defineDFE_SEEDTWICE-15/* DD list already seeded: internal error */
  382. #defineDFE_NOSPACE-16/* Malloc failed */
  383. #defineDFE_NOSUCHTAG-17/* No such tag in the file: search failed*/
  384. #defineDFE_READERROR-18/* There was a read error */
  385. #defineDFE_WRITEERROR-19/* There was a write error */
  386. #defineDFE_SEEKERROR-20/* There was a seek error */
  387. #defineDFE_NOFREEDD-21/* No free DD's left: internal error */
  388. #defineDFE_BADTAG-22/* illegal WILDCARD tag */
  389. #defineDFE_BADREF-23/* illegal WILDCARD reference # */
  390. #defineDFE_RDONLY-24/* The DF is read only */
  391. #defineDFE_BADCALL-25/* Calls in wrong order */
  392. #defineDFE_BADPTR-26 /* NULL ptr argument */
  393. #defineDFE_BADLEN-27/* negative len specified */
  394. #defineDFE_BADSEEK-28/* Attempt to seek past end of element */
  395. #defineDFE_NOMATCH-29/* No (more) DDs which match specified tag/ref */
  396. #defineDFE_NOTINSET-30/* Warning: Set contained unknown tag: ignored */
  397. #defineDFE_BADDIM-31/* negative or zero dimensions specified */
  398. #defineDFE_BADOFFSET-32/* Illegal offset specified */
  399. #defineDFE_BADSCHEME-33/* Unknown compression scheme specified */
  400. #defineDFE_NODIM-34/* No dimension record associated with image */
  401. #defineDFE_NOTENOUGH-35/* space provided insufficient for size of data 
  402.  
  403.  
  404. Figure B.2  C Header File: df.h (Continued)
  405.  
  406. */
  407. #defineDFE_NOVALS-36/* Values not available */
  408. #defineDFE_CORRUPT-37/* File is corrupted */
  409. #defineDFE_BADCONV-37/* Don't know how to convert data type */
  410. #defineDFE_BADFP-38/* The file contained an illegal floating point no*/
  411.  
  412. /*--------------------------------------------------------------------------*/
  413. /*Logical Constants */
  414.  
  415. #defineDFACC_READ1/* Read Access */
  416. #defineDFACC_WRITE2/* Write Access */
  417. #defineDFACC_CREATE4/* force file to be created */
  418. #defineDFACC_ALL7/* logical and of all the above values */
  419.  
  420. #endif DFTAG_NULL
  421.  
  422.  
  423.  
  424.