gpp4  1.3.1
library_file.h
Go to the documentation of this file.
1 /*
2  library_file.h: header file for library_file.c
3  Copyright (C) 2001 CCLRC, Charles Ballard
4 
5  This library is free software: you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation, either
8  version 3 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with This library. If not, see
17  <http://www.gnu.org/licenses/>.
18 
19 */
20 
26 #ifndef __CCP4_LIB_FILE
27 #define __CCP4_LIB_FILE
28 
29 #include "ccp4_sysdep.h"
30 #include "ccp4_types.h"
31 
32 #ifdef __cplusplus
33 namespace CCP4 {
34 extern "C" {
35 #endif
36 
38 typedef struct _CFileStruct CCP4File;
39 
40 struct _CFileStruct {
41  char *name;
42  FILE *stream;
43  int fd;
44  unsigned int read : 1;
45  unsigned int write : 1;
46  unsigned int append : 1;
47  unsigned int binary : 1;
48  unsigned int scratch : 1 , : 3;
49  unsigned int buffered : 1;
50  unsigned int sync : 1, : 6;
51  unsigned int direct : 1, : 7;
52  unsigned int open : 1;
53  unsigned int own : 1;
54  unsigned int last_op : 2;
55  unsigned int getbuff : 1, : 4;
56  int iostat;
57  unsigned int mode : 8;
58  unsigned int itemsize : 8;
59  unsigned int iconvert : 8;
60  unsigned int fconvert: 8;
61  off_t length;
62  off_t loc;
63  size_t stamp_loc;
64  int (*_read) (CCP4File *, uint8 *, size_t);
65  int (*_write) (CCP4File *, const uint8 *, size_t);
66  char buff[8];
67  void *priv;
68 };
69 
70 
71 CCP4File *ccp4_file_open (const char *, const int);
72 
73 CCP4File *ccp4_file_open_file (const FILE *, const int);
74 
75 CCP4File *ccp4_file_open_fd (const int, const int);
76 
78 
80 
82 
83 int ccp4_file_mode ( const CCP4File*);
84 
85 int ccp4_file_setmode ( CCP4File*, const int);
86 
87 int ccp4_file_setstamp( CCP4File *, const size_t);
88 
89 int ccp4_file_itemsize( const CCP4File*);
90 
91 int ccp4_file_setbyte( CCP4File *, const int);
92 
93 int ccp4_file_byteorder( CCP4File *);
94 
95 int ccp4_file_is_write(const CCP4File *);
96 
97 int ccp4_file_is_read(const CCP4File *);
98 
99 int ccp4_file_is_append(const CCP4File *);
100 
101 int ccp4_file_is_scratch(const CCP4File *);
102 
103 int ccp4_file_is_buffered(const CCP4File *);
104 
105 int ccp4_file_status(const CCP4File *);
106 
107 const char *ccp4_file_name( CCP4File *);
108 
109 int ccp4_file_read ( CCP4File*, uint8 *, size_t);
110 
111 int ccp4_file_readcomp ( CCP4File*, uint8 *, size_t);
112 
113 int ccp4_file_readshortcomp ( CCP4File*, uint8 *, size_t);
114 
115 int ccp4_file_readfloat ( CCP4File*, uint8 *, size_t);
116 
117 int ccp4_file_readint ( CCP4File*, uint8 *, size_t);
118 
119 int ccp4_file_readshort ( CCP4File*, uint8 *, size_t);
120 
121 int ccp4_file_readchar ( CCP4File*, uint8 *, size_t);
122 
123 int ccp4_file_write ( CCP4File*, const uint8 *, size_t);
124 
125 int ccp4_file_writecomp ( CCP4File*, const uint8 *, size_t);
126 
127 int ccp4_file_writeshortcomp ( CCP4File*, const uint8 *, size_t);
128 
129 int ccp4_file_writefloat ( CCP4File*, const uint8 *, size_t);
130 
131 int ccp4_file_writeint ( CCP4File*, const uint8 *, size_t);
132 
133 int ccp4_file_writeshort ( CCP4File*, const uint8 *, size_t);
134 
135 int ccp4_file_writechar ( CCP4File*, const uint8 *, size_t);
136 
137 int ccp4_file_seek ( CCP4File*, long, int);
138 
139 void ccp4_file_rewind ( CCP4File*);
140 
141 void ccp4_file_flush (CCP4File *);
142 
143 long ccp4_file_length ( CCP4File*);
144 
145 long ccp4_file_tell ( CCP4File*);
146 
147 int ccp4_file_feof(CCP4File *);
148 
150 
151 void ccp4_file_fatal (CCP4File *, char *);
152 
153 char *ccp4_file_print(CCP4File *, char *, char *);
154 
155 int ccp4_file_raw_seek( CCP4File *, long, int);
156 int ccp4_file_raw_read ( CCP4File*, char *, size_t);
157 int ccp4_file_raw_write ( CCP4File*, const char *, size_t);
158 int ccp4_file_raw_setstamp( CCP4File *, const size_t);
159 #ifdef __cplusplus
160 }
161 }
162 #endif
163 
164 #endif /* __CCP4_LIB_FILE */
165 
166 /*
167  Local variables:
168  mode: font-lock
169  End:
170 */