/*
	Include this in 'dfopen.h' then it should work ? 
	In lib.c and dfopen.c where we 'undef' fopen, change it to use solfopen,solfclose...



*/
#ifndef SOL_DONE
#define SOL_DONE

typedef struct SOLFILE_S {
        char *_ptr;
        int   _cnt;
        char *_base;
        int   _flag;
        int   _file;
        int   _charbuf;
        int   _bufsiz;
        char *_tmpfname;
		int locked; // True if this stream has been locked for us.
		int lock_thid; // Thread that owns the lock.
} SOLFILE; 

size_t solfwrite (const void *buffer, size_t size, size_t count, SOLFILE *stream);
int sol_init(int (*vemsg)( const char *format ,...));
int solfclose(SOLFILE *f);
int solfeof(SOLFILE *f);
int feof_checked(FILE *x);
SOLFILE * solfopen (const char *filename, const char *mode);
int sol_flush (SOLFILE *str);
int solfflush(SOLFILE *f);
char *solfgets( char *string, int count, SOLFILE *stream );
int solfileno(SOLFILE *f);
int solfprintf(SOLFILE *f,const char * arg_list, ...);
size_t solfread_lk(void *buffer, size_t size, size_t count, SOLFILE *stream);
size_t solfread(void *buffer, size_t size, size_t count, SOLFILE *stream);
size_t solfread_lk(void *buffer, size_t size, size_t num, SOLFILE *stream);
size_t solfwrite (const void *buffer, size_t size, size_t count, SOLFILE *stream);
size_t sol_fwrite_lk(const void *buffer, size_t size, size_t count, SOLFILE *stream);
int solfseek(SOLFILE *stream, long offset, int whence);
void sol_getbuf(SOLFILE *stream);
int sol_filbuf(SOLFILE *stream);
long solftell_lk(SOLFILE *stream);
long solftell(SOLFILE *stream);
int sol_freebuf(SOLFILE *stream);
int solsetvbuf( SOLFILE *stream, char *buffer, int type, size_t size );
char *sol_tmpname(void);
SOLFILE *soltmpfile(void);
void solclearerr(SOLFILE *stream);
int solferror (SOLFILE *stream);

#ifndef SOL_MAIN
#ifndef USE_SOL

#define solfread fread
#define solfwrite fwrite
#define solfopen fopen
#define solfclose fclose
#define solfeof feof
#define solfgets fgets
#define SOLFILE FILE
#define solfflush fflush
#define solfileno fileno
#define solfprintf fprintf
#define solfseek fseek
#define solftell ftell
#define solsetvbuf setvbuf
#define solclearerr clearerr
#define solferror ferror 
#endif
#endif


#ifdef USE_SOL_DEF
#ifdef feof
#undef feof
#endif
#ifdef ferror
#undef ferror
#endif

#define feof solfeof
#define FILE SOLFILE
#define fflush solfflush
#define fileno solfileno
#define fprintf solfprintf
#define fseek solfseek
#define ftell solftell
#define setvbuf solsetvbuf
#define clearerr solclearerr
#define ferror solferror 
#endif

#endif
