MISR Toolkit  1.5.1
df.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF. The full HDF copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the files COPYING and Copyright.html. COPYING can be found at the root *
9  * of the source code distribution tree; Copyright.html can be found at *
10  * http://hdfgroup.org/products/hdf4/doc/Copyright.html. If you do not have *
11  * access to either file, you may request a copy from help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id: df.h 5444 2010-08-25 16:40:05Z byrn $ */
15 
16 /*-----------------------------------------------------------------------------
17  * File: df.h
18  * Purpose: header file for HDF routines
19  * Invokes: dfi.h
20  * Contents:
21  * Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata
22  * Procedure type definitions
23  * Global variables
24  * Tag definitions
25  * Error return codes
26  * Logical constants
27  * Remarks: This file is included with user programs
28  * Since it includes stdio.h etc., do not include these after df.h
29  *---------------------------------------------------------------------------*/
30 
31 #ifndef DF_H /* avoid re-inclusion */
32 #define DF_H
33 
34 #include "H4api_adpt.h"
35 
36 /* include DF (internal) header information */
37 #include "hdf.h"
38 
39 /*-------------------------------------------------------------------------*/
40 /* Type declarations */
41 
42 typedef struct DFddh
43  { /*format of data descriptor headers in file */
44  int16 dds; /* number of dds in header block */
45  int32 next; /* offset of next header block */
46  }
47 DFddh;
48 
49 typedef struct DFdd
50  { /* format of data descriptors as in file */
51  uint16 tag; /* data tag */
52  uint16 ref; /* data reference number */
53  int32 offset; /* offset of data element in file */
54  int32 length; /* number of bytes */
55  }
56 DFdd;
57 
58 /* descriptor structure is same as dd structure. ###Note: may be changed */
59 typedef DFdd DFdesc;
60 
61 /* DLE is the internal structure which stores data descriptor information */
62 /* It is a linked list of DDs */
63 typedef struct DFdle
64  { /* Data List element */
65  struct DFdle *next; /* link to next dle */
66  DFddh ddh; /* To store headers */
67  DFdd dd[1]; /* dummy size */
68  }
69 DFdle;
70 
71 /* DF is the internal structure associated with each DF file */
72 /* It holds information associated with the file as a whole */
73 /* ### Note: there are hooks for having multiple DF files open at a time */
74 typedef struct DF
75  {
76  DFdle *list; /* Pointer to the DLE list */
77  DFdle *last_dle; /* last_dle and last_dd are used in searches */
78  /* to indicate element returned */
79  /* by previous call to DFfind */
80  DFdd *up_dd; /* DD of element being read/updated, */
81  /* used by DFstart */
82  uint16 last_tag; /* Last tag searched for by DFfind */
83  uint16 last_ref; /* Last reference number searched for */
84  intn type; /* 0= not in use, 1= normal, -1 = multiple */
85  /* this is a hook for when */
86  /* multiple files are open */
87  intn access; /* permitted access types: */
88  /* 0=none, 1=r, 2=w, 3=r/w */
89  intn changed; /* True if anything in DDs modified */
90  /* since last write */
91  intn last_dd; /* see last_dle */
92  intn defdds; /* default numer of DD's in each block */
93  intn up_access; /* access permissions to element being */
94  /* read/updated. Used by DFstart */
95  /* File handle is a file pointer or file descriptor depending on whether */
96  /* we use buffered or unbuffered I/O. But, since this structure is a */
97  /* fake, it doesn't matter whether I/O is buffered or not. */
98  intn file; /* file descriptor */
99  }
100 DF;
101 
102 typedef struct DFdata
103  { /* structure for returning status information */
104  int32 version; /* version number of program */
105  }
106 DFdata;
107 
108 /*--------------------------------------------------------------------------*/
109 /* Procedure types */
110 
111 #if defined c_plusplus || defined __cplusplus
112 extern "C"
113 {
114 #endif /* c_plusplus || __cplusplus */
115 
116 /* prototypes for dfstubs.c */
118  (char *name, int acc_mode, int ndds);
119 
120  HDFLIBAPI int DFclose
121  (DF * dfile);
122 
124  (DF * dfile, DFdesc ptr[], int begin, int num);
125 
126  HDFLIBAPI int DFnumber
127  (DF * dfile, uint16 tag);
128 
129  HDFLIBAPI int DFsetfind
130  (DF * dfile, uint16 tag, uint16 ref);
131 
132  HDFLIBAPI int DFfind
133  (DF * dfile, DFdesc * ptr);
134 
135  HDFLIBAPI int DFaccess
136  (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
137 
138  HDFLIBAPI int DFstart
139  (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
140 
141  HDFLIBAPI int32 DFread
142  (DF * dfile, char *ptr, int32 len);
143 
144  HDFLIBAPI int32 DFseek
145  (DF * dfile, int32 offset);
146 
147  HDFLIBAPI int32 DFwrite
148  (DF * dfile, char *ptr, int32 len);
149 
150  HDFLIBAPI int DFupdate
151  (DF * dfile);
152 
153  HDFLIBAPI int DFstat
154  (DF * dfile, DFdata * dfinfo);
155 
156  HDFLIBAPI int32 DFgetelement
157  (DF * dfile, uint16 tag, uint16 ref, char *ptr);
158 
159  HDFLIBAPI int32 DFputelement
160  (DF * dfile, uint16 tag, uint16 ref, char *ptr, int32 len);
161 
162  HDFLIBAPI int DFdup
163  (DF * dfile, uint16 itag, uint16 iref, uint16 otag, uint16 oref);
164 
165  HDFLIBAPI int DFdel
166  (DF * dfile, uint16 tag, uint16 ref);
167 
168  HDFLIBAPI uint16 DFnewref
169  (DF * dfile);
170 
171  HDFLIBAPI int DFishdf
172  (char *filename);
173 
174  HDFLIBAPI int DFerrno
175  (void);
176 
177  HDFLIBAPI int DFIerr
178  (DF * dfile);
179 
181  (char *from, char *to, int length);
182 
183  HDFLIBAPI void *DFIgetspace
184  (uint32 qty);
185 
186  HDFLIBAPI void *DFIfreespace
187  (void *ptr);
188 
189  HDFLIBAPI int DFIc2fstr
190  (char *str, int len);
191 
192  HDFLIBAPI char *DFIf2cstring
193  (_fcd fdesc, intn len);
194 
195 /* prototypes for dfconv.c */
196  HDFLIBAPI int DFconvert
197  (uint8 *source, uint8 *dest, int ntype, int sourcetype, int desttype, int32 size);
198 
199 #if defined c_plusplus || defined __cplusplus
200 }
201 #endif /* c_plusplus || __cplusplus */
202 
203 /*--------------------------------------------------------------------------*/
204 /* Global Variables */
205 
206 #ifndef DFMASTER
207 HDFLIBAPI
208 #endif /*DFMASTER */
209 int DFerror; /* Error code for DF routines */
210 
211 #define DFSETERR(error) (DFerror=(DFerror?DFerror:error))
212 
213 #define DFTOFID(df) (int32)(df->list)
214 
215 #endif /* DF_H */
DFdle * list
Definition: df.h:76
HDFLIBAPI int DFupdate(DF *dfile)
HDFFCLIBAPI intf * len
HDFLIBAPI void * DFIfreespace(void *ptr)
int32 version
Definition: df.h:104
HDFLIBAPI int32 DFwrite(DF *dfile, char *ptr, int32 len)
Definition: df.h:49
HDFLIBAPI int32 DFseek(DF *dfile, int32 offset)
HDFLIBAPI int DFerror
Definition: df.h:209
HDFFCLIBAPI intf * itag
HDFFCLIBAPI DFdata * dfinfo
HDFLIBAPI int DFclose(DF *dfile)
char * filename
Definition: cdjpeg.h:133
HDFFCLIBAPI intf intf * iref
HDFLIBAPI int DFIerr(DF *dfile)
HDFLIBAPI int DFconvert(uint8 *source, uint8 *dest, int ntype, int sourcetype, int desttype, int32 size)
HDFLIBAPI int DFerrno(void)
HDFFCLIBAPI intf intf * begin
HDFFCLIBAPI intf intf intf intf * oref
HDFLIBAPI int DFsetfind(DF *dfile, uint16 tag, uint16 ref)
struct DFdle DFdle
HDFLIBAPI char * DFIf2cstring(_fcd fdesc, intn len)
HDFLIBAPI int DFishdf(char *filename)
DFdle * last_dle
Definition: df.h:77
char * _fcd
Definition: H5f90i.h:37
intn changed
Definition: df.h:89
HDFLIBAPI int DFImemcopy(char *from, char *to, int length)
DFdd DFdesc
Definition: df.h:59
intn file
Definition: df.h:98
int32 next
Definition: df.h:45
DFddh ddh
Definition: df.h:66
HDFFCLIBAPI _fcd name
HDFFCLIBAPI intf intf * ref
HDFFCLIBAPI intf intf intf * otag
HDFLIBAPI int DFdel(DF *dfile, uint16 tag, uint16 ref)
HDFLIBAPI int DFnumber(DF *dfile, uint16 tag)
HDFLIBAPI int DFstat(DF *dfile, DFdata *dfinfo)
HDFLIBAPI int DFaccess(DF *dfile, uint16 tag, uint16 ref, char *acc_mode)
HDFFCLIBAPI intf * size
HDFLIBAPI int DFdup(DF *dfile, uint16 itag, uint16 iref, uint16 otag, uint16 oref)
struct DFddh DFddh
uint16 ref
Definition: df.h:52
intn access
Definition: df.h:87
HDFFCLIBAPI intf * tag
HDFLIBAPI int DFdescriptors(DF *dfile, DFdesc ptr[], int begin, int num)
HDFLIBAPI uint16 DFnewref(DF *dfile)
HDFFCLIBAPI intf intf intf * num
HDFLIBAPI int32 DFputelement(DF *dfile, uint16 tag, uint16 ref, char *ptr, int32 len)
HDFLIBAPI void * DFIgetspace(uint32 qty)
intn last_dd
Definition: df.h:91
intn defdds
Definition: df.h:92
int16 dds
Definition: df.h:44
HDFFCLIBAPI intf * acc_mode
Definition: df.h:63
struct DFdata DFdata
int32 offset
Definition: df.h:53
struct DFdd DFdd
HDFLIBAPI int32 DFgetelement(DF *dfile, uint16 tag, uint16 ref, char *ptr)
Definition: df.h:74
struct DFdle * next
Definition: df.h:65
uint16 tag
Definition: df.h:51
DFdd * up_dd
Definition: df.h:80
HDFLIBAPI DF * DFopen(char *name, int acc_mode, int ndds)
HDFLIBAPI int DFstart(DF *dfile, uint16 tag, uint16 ref, char *acc_mode)
#define HDFLIBAPI
Definition: H4api_adpt.h:195
HDFFCLIBAPI intf ptr[][4]
HDFFCLIBAPI intf * offset
uint16 last_ref
Definition: df.h:83
intn up_access
Definition: df.h:93
int32 length
Definition: df.h:54
HDFLIBAPI int DFfind(DF *dfile, DFdesc *ptr)
struct DF DF
HDFLIBAPI int DFIc2fstr(char *str, int len)
uint16 last_tag
Definition: df.h:82
HDFLIBAPI int32 DFread(DF *dfile, char *ptr, int32 len)
Definition: df.h:102
intn type
Definition: df.h:84
Definition: df.h:42
DFdd dd[1]
Definition: df.h:67

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52