/*	Copyright 1993 H.Ogasawara (COR.)	*/

#ifndef __MICROFIO__
#define	__MICROFIO__

#ifndef __dos_inline_call__
# include	<sys_doslib.h>
#endif

#define	MFBUFSIZE	4096

typedef	struct {
		int	fn;
		unsigned char	*ptr;
		unsigned char	*limit;
		unsigned char	buf[MFBUFSIZE];
	} m_file;

#ifndef __MicroLIB__

extern int	Mopen( m_file*, const char* );
extern int	Mcreate( m_file*, const char* );
extern int	Mappend( m_file*, const char* );
#define		Mclose( fm )	(CLOSE((fm)->fn))
extern int	Mgets( m_file*, char*, int );
extern int	Mputs( m_file*, const char* );
extern int	Mread( m_file*, void*, int );
extern int	Mwrite( m_file*, const void*, int );
extern void	Mflush( m_file* );
extern void	Mseekl( m_file*, int );
#define		Mseek( fm, pos, mode )	(SEEK((fm)->fn,pos,mode))
extern int	Mgetc( m_file* );
extern int	MMgetc( m_file* );
extern int	Mputc( m_file*, const int );
extern int	MMputc( m_file*, const int );
extern int	Mputw( m_file*, const int );
extern int	Mputl( m_file*, const int );
extern int	Mgetl( m_file* );
extern int	Mgetw( m_file* );
extern int	Mfsize( m_file* );
extern void	*MallocRead( const char* );
extern void	*MallocReadOffset( const char*, int );
extern void	*MallocReadTopOffset( const char*, int );
#define		MallocSize( ptr )	(((int*)(ptr))[-2]-(int)(ptr))
extern int	McreateWrite( const char*, const void*, int );

#endif

#endif
