
/*
 *  DEFS.H
 *
 */

/*  useful with GCC macro-based inlines */
#define __CONSTLIBBASEDECL__ const

#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/ports.h>
#include <exec/memory.h>
#include <exec/libraries.h>
#include <exec/execbase.h>
#include <exec/semaphores.h>
#include <devices/timer.h>
#if defined(_DCC)
#include <clib/exec_protos.h>
#include <clib/alib_protos.h>
#else
#include <proto/exec.h>
#include <proto/alib.h>
#endif
#include <libraries/fifo.h>
/*  do NOT include prototypes or inlines in the library itself */
#include <string.h>
#if defined(__GNUC__) && defined(__OPTIMIZE__)
#include <inline/strsup.h>
#endif

#if defined(__GNUC__)
#define LibCall
#else
#define LibCall __geta4 __stkargs
#endif
#define Prototype extern

typedef unsigned char ubyte;
typedef unsigned short uword;
typedef unsigned long ulong;
typedef struct MsgPort	MsgPort;
typedef struct Message	Message;
typedef struct MinNode	Node;
typedef struct MinList	List;
typedef struct List	MaxList;
typedef struct Node	MaxNode;
typedef struct Library	Library;
typedef struct ExecBase ExecBase;
typedef struct SignalSemaphore SignalSemaphore;

#define FIFOF_CLOSEOF	0x00010000
#define FIFOF_RDNORM	0x00020000
#define FIFOF_WRNORM	0x00040000

typedef struct Fifo {
    MaxNode fi_Node;
    List    fi_HanList;
    List    fi_WrNotify;
    List    fi_RdNotify;
    uword   fi_RRefs;
    uword   fi_WRefs;
    uword   fi_ORefs;
    ubyte   fi_Lock;		/*  non-normal fifo's   */
    ubyte   fi_Reserved;
    long    fi_RIdx;
    long    fi_WIdx;
    long    fi_Flags;
    SignalSemaphore fi_SigSem;	/*  normal fifo's       */
    long    fi_BufSize;
    long    fi_BufMask;
    char    fi_Buf[4];
} Fifo;

typedef struct FHan {
    Node    fh_Node;
    Fifo    *fh_Fifo;
    long    fh_Flags;
    MsgPort fh_Port;
    Message fh_Msg;
    long    fh_RIdx;
} FHan;

extern const char LibName[];
extern const char LibId[];
extern List FifoList;
extern ExecBase * SysBase;

/* Were Protoize used
#include "fifolib-protos.h"
*/
