gpp4 1.3.1
|
00001 /* 00002 library_file.h: header file for library_file.c 00003 Copyright (C) 2001 CCLRC, Charles Ballard 00004 00005 This library is free software: you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation, either 00008 version 3 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with This library. If not, see 00017 <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00026 #ifndef __CCP4_LIB_FILE 00027 #define __CCP4_LIB_FILE 00028 00029 #include "ccp4_sysdep.h" 00030 #include "ccp4_types.h" 00031 00032 #ifdef __cplusplus 00033 namespace CCP4 { 00034 extern "C" { 00035 #endif 00036 00038 typedef struct _CFileStruct CCP4File; 00039 00040 struct _CFileStruct { 00041 char *name; 00042 FILE *stream; 00043 int fd; 00044 unsigned int read : 1; 00045 unsigned int write : 1; 00046 unsigned int append : 1; 00047 unsigned int binary : 1; 00048 unsigned int scratch : 1 , : 3; 00049 unsigned int buffered : 1; 00050 unsigned int sync : 1, : 6; 00051 unsigned int direct : 1, : 7; 00052 unsigned int open : 1; 00053 unsigned int own : 1; 00054 unsigned int last_op : 2; 00055 unsigned int getbuff : 1, : 4; 00056 int iostat; 00057 unsigned int mode : 8; 00058 unsigned int itemsize : 8; 00059 unsigned int iconvert : 8; 00060 unsigned int fconvert: 8; 00061 off_t length; 00062 off_t loc; 00063 size_t stamp_loc; 00064 int (*_read) (CCP4File *, uint8 *, size_t); 00065 int (*_write) (CCP4File *, const uint8 *, size_t); 00066 char buff[8]; 00067 void *priv; 00068 }; 00069 00070 00071 CCP4File *ccp4_file_open (const char *, const int); 00072 00073 CCP4File *ccp4_file_open_file (const FILE *, const int); 00074 00075 CCP4File *ccp4_file_open_fd (const int, const int); 00076 00077 int ccp4_file_rarch ( CCP4File*); 00078 00079 int ccp4_file_warch ( CCP4File*); 00080 00081 int ccp4_file_close ( CCP4File*); 00082 00083 int ccp4_file_mode ( const CCP4File*); 00084 00085 int ccp4_file_setmode ( CCP4File*, const int); 00086 00087 int ccp4_file_setstamp( CCP4File *, const size_t); 00088 00089 int ccp4_file_itemsize( const CCP4File*); 00090 00091 int ccp4_file_setbyte( CCP4File *, const int); 00092 00093 int ccp4_file_byteorder( CCP4File *); 00094 00095 int ccp4_file_is_write(const CCP4File *); 00096 00097 int ccp4_file_is_read(const CCP4File *); 00098 00099 int ccp4_file_is_append(const CCP4File *); 00100 00101 int ccp4_file_is_scratch(const CCP4File *); 00102 00103 int ccp4_file_is_buffered(const CCP4File *); 00104 00105 int ccp4_file_status(const CCP4File *); 00106 00107 const char *ccp4_file_name( CCP4File *); 00108 00109 int ccp4_file_read ( CCP4File*, uint8 *, size_t); 00110 00111 int ccp4_file_readcomp ( CCP4File*, uint8 *, size_t); 00112 00113 int ccp4_file_readshortcomp ( CCP4File*, uint8 *, size_t); 00114 00115 int ccp4_file_readfloat ( CCP4File*, uint8 *, size_t); 00116 00117 int ccp4_file_readint ( CCP4File*, uint8 *, size_t); 00118 00119 int ccp4_file_readshort ( CCP4File*, uint8 *, size_t); 00120 00121 int ccp4_file_readchar ( CCP4File*, uint8 *, size_t); 00122 00123 int ccp4_file_write ( CCP4File*, const uint8 *, size_t); 00124 00125 int ccp4_file_writecomp ( CCP4File*, const uint8 *, size_t); 00126 00127 int ccp4_file_writeshortcomp ( CCP4File*, const uint8 *, size_t); 00128 00129 int ccp4_file_writefloat ( CCP4File*, const uint8 *, size_t); 00130 00131 int ccp4_file_writeint ( CCP4File*, const uint8 *, size_t); 00132 00133 int ccp4_file_writeshort ( CCP4File*, const uint8 *, size_t); 00134 00135 int ccp4_file_writechar ( CCP4File*, const uint8 *, size_t); 00136 00137 int ccp4_file_seek ( CCP4File*, long, int); 00138 00139 void ccp4_file_rewind ( CCP4File*); 00140 00141 void ccp4_file_flush (CCP4File *); 00142 00143 long ccp4_file_length ( CCP4File*); 00144 00145 long ccp4_file_tell ( CCP4File*); 00146 00147 int ccp4_file_feof(CCP4File *); 00148 00149 void ccp4_file_clearerr(CCP4File *); 00150 00151 void ccp4_file_fatal (CCP4File *, char *); 00152 00153 char *ccp4_file_print(CCP4File *, char *, char *); 00154 00155 int ccp4_file_raw_seek( CCP4File *, long, int); 00156 int ccp4_file_raw_read ( CCP4File*, char *, size_t); 00157 int ccp4_file_raw_write ( CCP4File*, const char *, size_t); 00158 int ccp4_file_raw_setstamp( CCP4File *, const size_t); 00159 #ifdef __cplusplus 00160 } 00161 } 00162 #endif 00163 00164 #endif /* __CCP4_LIB_FILE */ 00165 00166 /* 00167 Local variables: 00168 mode: font-lock 00169 End: 00170 */