/***************************************************************************
 *
 * file.h
 *
 ***************************************************************************
 *
 * wrapper for platform independant file io
 *
 ***************************************************************************/

#ifndef FILE_H_INCLUDED
#define FILE_H_INCLUDED

/*
 * includes
 */

/*
 * defines
 */

#ifndef SEEK_SET
#define SEEK_SET    0			/*  Seek relative to start of file  */
#define SEEK_CUR    1			/*  Seek relative to current positn */
#define SEEK_END    2			/*  Seek relative to end of file    */
#endif

/*
 * typedefs
 */

typedef void * FH;

/*
 * structures
 */

typedef struct DIR_INFO_S
	{
	char                name[16];
	unsigned long       flags;
	unsigned long       romLength;
	unsigned long       romOffset;
	unsigned long       ramLength;
	} DIR_INFO_T;

/*
 * globals
 */

/*
 * function prototypes
 */

extern int                 FileInit(void *data);
extern int                 FileShutdown(void);
extern void                FileUnInit(void);

extern FH                  FileOpen(char *name,char *mode);
extern void                FileClose(FH fh);
extern void                FileSeek(FH fh,unsigned long offset,int mode);
extern unsigned long       FileTell(FH fh);
extern unsigned long       FileRead(void *buffer,int s,int c,FH fh);
extern unsigned long       FileWrite(void *buffer,int s,int c,FH fh);
extern int                 FileEof(FH fh);

extern int                 FileFgetc(FH fh);
extern void                FileFputc(int c,FH fh);
extern void                FileRewind(FH fh);

extern DIR_INFO_T *        FileRomInfo(char *name);

#endif
