
/*  MRARPFile.h
 *  Definitions for ARP extended file support.
 *  Author: Mark R. Rinfret
 */
#ifndef MRARPFILE_H
#define MRARPFILE_H

#include <libraries/arpbase.h>
#include <libraries/dosextens.h>

typedef struct {
    BPTR                fh;             /* AmigaDOS FileHandle pointer */
    struct DefaultTracker *fileTracker;
    char                *buf;           /* read/write buffer */
    LONG                bufSize;        /* allocated size of buffer */
    LONG                bufLength;      /* number of bytes in buffer */
    LONG                bufPos;         /* read/write position */
    LONG                mode;           /* how file was opened */
    LONG                lastError;      /* last error code encountered */
    LONG                lastPosition;   /* position of last access */
    WORD                endOfFile;      /* used by FRead, FGets */
    } ARPFileHandle;

/* Function declarations: */

/* MRARPFile.c */
#ifndef __PARMS
/* Attempt to accommodate both Lattice and Manx. I believe Lattice uses
 * macro ARGs for conditional ANSI parameters. Manx uses __PARMS.
 */
#ifdef ARGs
# define __PARMS ARGs
#else
# if __STDC__
#   define __PARMS(x) x
# else
#   define __PARMS(x) ()
# endif
#endif ARGs

#endif __PARMS

char *FGetsARP __PARMS((char *s, LONG length, ARPFileHandle *file));
LONG FPutsARP __PARMS((char *s, ARPFileHandle *file));
LONG ReadARPFile __PARMS((ARPFileHandle *file, char *buffer, LONG length));
LONG CloseARPFile __PARMS((ARPFileHandle *file));
ARPFileHandle   *OpenARPFile __PARMS((char *name, LONG accessMode, LONG bytes));
LONG SeekARPFile __PARMS((ARPFileHandle *file, LONG position, LONG mode));
LONG WriteARPFile __PARMS((ARPFileHandle *file, const char *buffer, LONG length));

#endif

