home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 110
/
EnigmaAmiga110CD.iso
/
indispensabili
/
utility
/
apdf
/
xpdf-0.80
/
xpdf
/
mystdio.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-20
|
1KB
|
56 lines
//========================================================================
//
// mystdio.h
//
// Copyright 1999 Emmanuel Lesueur
//
//========================================================================
#ifndef MYSTDIO_H
#define MYSTDIO_H
class myFILE {
public:
myFILE(const char*);
~myFILE();
size_t read(void*,size_t);
int seek(long,int);
long tell() const { return pos; }
void rewind() { pos=0; }
static void bufsizes(size_t chunk_size,size_t max_size);
private:
class chunk {
public:
chunk() : buf(NULL) {}
~chunk() { delete [] buf; }
chunk* next;
chunk* prev;
unsigned char* buf;
};
size_t pos;
chunk* chunks;
unsigned num_chunks;
size_t chunk_size;
long file;
size_t total_size;
int max_loaded_chunks;
int num_loaded_chunks;
chunk* loaded_chunks;
chunk* oldest_chunk;
size_t last_pos;
static size_t glb_chunk_size;
static size_t max_buf;
};
myFILE* myfopen(const char*,const char*);
inline int myfclose(myFILE* f) { delete f; }
inline size_t myfread(void* buf,size_t bsize,size_t n,myFILE* f) {
return f->read(buf,n*bsize)/bsize;
}
inline int myfseek(myFILE* f,long pos,int mode) { return f->seek(pos,mode); }
inline long myftell(myFILE* f) { return f->tell(); }
inline void myrewind(myFILE* f) { return f->rewind(); }
#endif