/usr/include/mmdb/file_.h is in libmmdb-dev 1.25.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | // $Id: file_.h,v 1.23 2012/01/26 17:52:19 ekr Exp $
// =================================================================
//
// CCP4 Coordinate Library: support of coordinate-related
// functionality in protein crystallography applications.
//
// Copyright (C) Eugene Krissinel 2000-2008.
//
// This library is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 3, modified in accordance with the provisions
// of the license to address the requirements of UK law.
//
// You should have received a copy of the modified GNU Lesser
// General Public License along with this library. If not, copies
// may be downloaded from http://www.ccp4.ac.uk/ccp4license.php
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// =================================================================
//
// 29.01.10 <-- Date of Last Modification.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// -----------------------------------------------------------------
//
// **** Module : file_ <interface>
// ~~~~~~~~~
// **** Classes : CFile - file I/O Support.
// ~~~~~~~~~
//
// (C) E. Krissinel 2000-2010
//
// =================================================================
//
#ifndef __File__
#define __File__
#ifndef __STDIO_H
#include <stdio.h>
#endif
#ifndef __MatType__
#include "mattype_.h"
#endif
// ======================== CFile Class ========================
#define MaxFileNameLength 512
#define FM_Binary False
#define FM_Text True
#define GZM_NONE 0
#define GZM_CHECK 1
#define GZM_ENFORCE 2
#define GZM_ENFORCE_GZIP 2
#define GZM_ENFORCE_COMPRESS 3
#define FileError_NoMemory 110
#define FileError_ShortData 111
#define FileError_NoDataFound 112
#define FileError_NoColumn 113
#define FileError_BadData 114
#define FileError_WrongMemoryAllocation 115
// =================== Auxilary Functions =========================
#define syskey_unix 1
#define syskey_win 2
#define syskey_all 3
extern cpstr GetFPath ( pstr FilePath, int syskey=syskey_unix );
extern cpstr GetFName ( cpstr FilePath, int syskey=syskey_unix );
extern cpstr GetFExt ( cpstr FilePath );
extern cpstr ChangeExt ( pstr FilePath, cpstr newExt,
int syskey=syskey_unix );
extern cpstr FileError ( int ErrCode );
extern void RemoveDelimiters ( pstr S, int SLen );
extern void PickOutNumber ( cpstr S, pstr SV, int SLen, int & j );
#ifdef _WIN32
#define _dir_sep_c '\\'
#define _dir_sep "\\"
#else
#define _dir_sep_c '/'
#define _dir_sep "/"
#endif
// ========================= CFile ================================
DefineClass(CFile)
class CFile {
public :
CFile ( word BufSize=4096 );
virtual ~CFile();
// ---- control functions
// FileName allows for "stdin", "stdout" and "stderr" as
// for standard UNIX streams.
void assign ( cpstr FileName,
Boolean Text=False,
Boolean UniB=False,
byte gzMode=GZM_NONE );
// assign for memory IO
void assign ( word poolSize, word sizeInc, pstr filePool );
void GetFilePool ( pstr & filePool, word & fileSize );
pstr FileName () { return FName; }
Boolean reset ( Boolean ReadOnly=False, int retry=0 );
// = true if opened, each retry 1 sec sleep
Boolean erase (); // = true if erased
Boolean exists (); // = true if exists
Boolean parse ( cpstr FileName ); // true if filled
Boolean rename ( cpstr NewFileName ); // true if renamed
Boolean rewrite (); // = true if opened
Boolean append (); // = true if opened
Boolean isOpen ();
long Position ();
long FileLength () { return FLength; }
Boolean seek ( long Position );
Boolean FileEnd ();
Boolean Success () { return IOSuccess; }
void SetSuccess () { IOSuccess = True; }
void shut ();
// ---- binary I/O
word ReadFile ( void * Buffer, word Count );
word CreateRead ( pstr & Line );
word ReadTerLine ( pstr Line, Boolean longLine=False );
Boolean WriteFile ( const void * Buffer, word Count );
Boolean CreateWrite ( cpstr Line );
Boolean WriteTerLine ( cpstr Line, Boolean longLine=False );
// machine-dependent binary I/O
Boolean WriteReal ( realtype * V );
Boolean WriteFloat ( realtype * V );
Boolean WriteInt ( int * I );
Boolean WriteShort ( short * S );
Boolean WriteLong ( long * L );
Boolean WriteBool ( Boolean * B );
Boolean WriteByte ( byte * B );
Boolean WriteWord ( word * W );
Boolean ReadReal ( realtype * V );
Boolean ReadFloat ( realtype * V );
Boolean ReadInt ( int * I );
Boolean ReadShort ( short * S );
Boolean ReadLong ( long * L );
Boolean ReadBool ( Boolean * B );
Boolean ReadByte ( byte * B );
Boolean ReadWord ( word * B );
Boolean AddReal ( realtype * V );
Boolean AddFloat ( realtype * V );
Boolean AddInt ( int * I );
Boolean AddShort ( short * S );
Boolean AddLong ( long * L );
Boolean AddByte ( byte * B );
Boolean AddWord ( word * B );
// complex data binary I/O
Boolean WriteVector ( rvector V, int len, int Shift );
Boolean WriteVector ( ivector iV, int len, int Shift );
Boolean WriteVector ( lvector lV, int len, int Shift );
Boolean WriteVector ( bvector B, int len, int Shift );
Boolean ReadVector ( rvector V, int maxlen, int Shift );
Boolean ReadVector ( ivector iV, int maxlen, int Shift );
Boolean ReadVector ( lvector lV, int maxlen, int Shift );
Boolean ReadVector ( bvector B, int maxlen, int Shift );
Boolean CreateReadVector ( rvector & V, int & len, int Shift );
Boolean CreateReadVector ( ivector & iV, int & len, int Shift );
Boolean CreateReadVector ( lvector & lV, int & len, int Shift );
Boolean CreateReadVector ( bvector & B, int & len, int Shift );
Boolean CreateReadVector ( rvector & V, int Shift );
Boolean CreateReadVector ( ivector & iV, int Shift );
Boolean CreateReadVector ( lvector & lV, int Shift );
Boolean CreateReadVector ( bvector & B, int Shift );
Boolean WriteMatrix ( rmatrix & A, int N, int M,
int ShiftN, int ShiftM );
Boolean CreateReadMatrix ( rmatrix & A, int ShiftN, int ShiftM );
Boolean CreateReadMatrix ( rmatrix & A, int & N, int & M,
int ShiftN, int ShiftM );
/// ---- text I/O
Boolean Write ( cpstr Line ); //!< writes without LF
Boolean Write ( realtype V, int length=10 ); //!< w/o LF
Boolean Write ( int iV, int length=5 ); //!< w/o LF
Boolean WriteLine ( cpstr Line ); //!< writes and adds LF
Boolean LF (); //!< just adds LF
word ReadLine ( pstr Line, word MaxLen=255 );
word ReadNonBlankLine ( pstr S, word MaxLen=255 );
/// complex data text I/O
// writes with spaces and adds LF
Boolean WriteDataLine ( realtype X, realtype Y,
int length=10 );
Boolean WriteParameter ( cpstr S, realtype X, // writes parameter
int ParColumn=40, // name S and value X
int length=10 ); // at column ParColumn
// and adds LF.
Boolean WriteParameters ( cpstr S, int n_X, // writes parameter
rvector X, // name S and n_X values
int ParColumn=40, // X[0..n_X-1] at col
int length=10 ); // ParColumn, ads LF.
Boolean ReadParameter ( pstr S, realtype & X, // reads parameter
int ParColumn=40 ); // name S and val X
Boolean ReadParameter ( pstr S, int & X,
int ParColumn=40 );
Boolean ReadParameters ( pstr S, int & n_X, // reads parameter
rvector X, // name S, counts the
int MaxLen=255, // of values n_X and
int ParColumn=40 ); // reads X[0..n_X-1].
// MaxLen gives sizeof(S)
// WriteColumns writes data stored in X, Y and Z in the form
// of columns, adding a blank line in the end. If Z (or Z and Y)
// are set to NULL, then only X and Y (or only X) are written.
// Shift corresponds to the begining of arrays' enumeration
// X[Shift..Shift+len-1].
Boolean WriteColumns ( rvector X, rvector Y, rvector Z,
int len, int Shift, int MLength );
Boolean WriteColumns ( rvector X, rvector Y,
int len, int Shift, int MLength );
// ReadColumns reads data stored by WriteColumns. X, Y, and Z
// must be allocated prior to call.
// xCol, yCol and zCol specify the order number of columns
// (starting from 0) to be read into X, Y and Z, correspondingly.
// If zCol (or zCol and yCol) < 0 then Z (or Z and Y) are not read.
// Shift corresponds to the begining of arrays' enumeration
// X[Shift..Shift+len-1].
// Returns number of lines read.
int ReadColumns ( int maxlen, rvector X, rvector Y, rvector Z,
int xCol, int yCol, int zCol, int Shift );
int ReadColumns ( int maxlen, rvector X, rvector Y,
int xCol, int yCol, int Shift );
// CreateReadColumns reads data stored by WriteColumns. X, Y,
// and Z must be set to NULL prior to call. They will be allocated
// within the procedure.
// xCol, yCol and zCol specify the order number of columns
// (starting from 0) to be read into X, Y and Z, correspondingly.
// If zCol (or zCol and yCol) < 0 then Z (or Z and Y) are not read.
// Shift corresponds to the begining of arrays' enumeration
// X[Shift..Shift+len-1].
// Returns number of lines read, errors are reported by
// ErrorCode().
int CreateReadColumns ( rvector & X, rvector & Y, rvector & Z,
int xCol, int yCol, int zCol, int Shift );
int CreateReadColumns ( rvector & X, rvector & Y,
int xCol, int yCol, int Shift );
// ---- miscellaneous
realtype GetNumber ( cpstr S );
FILE * GetHandle () { return hFile; }
protected :
word Buf_Size;
Boolean TextMode,UniBin;
byte gzipMode;
pstr IOBuf;
word BufCnt,BufLen,BufInc;
FILE * hFile;
Boolean EofFile;
pstr FName;
long FLength;
Boolean IOSuccess;
int ErrCode;
void FreeBuffer ();
void _ReadColumns ( int & DLen, pstr S, int SLen,
rvector X, rvector Y, rvector Z,
int xCol, int yCol, int zCol, int Shift );
private :
int gzipIO;
Boolean StdIO,memIO;
};
extern void SetGZIPPath ( pstr gzipPath, pstr ungzipPath );
extern void SetCompressPath ( pstr compressPath, pstr uncompressPath );
extern Boolean FileExists ( cpstr FileName, PCFile f=NULL );
#endif
|