#ifndef _APACHELIB_H_
#define _APACHELIB_H_

#define APACHELIB_VMIN 2
#define APACHELIB_NAME "/Apache.library"     // Library name for PlugIns

struct BusyVars
{
  APTR app,win,text,proc;
};

typedef struct RangeInfo
{
  char *title;
  char *lowtext;
  char *hightext;
  LONG low;
  LONG lowinitial;
  LONG high;
  LONG highinitial;
} RangeInfo;

struct GetNumberVars
{
  APTR app;
  char *title;
  LONG min;
  LONG max;
  LONG initial;
};

// Flags for flags field in GetFileNameVars

#define ALFR_ASK         1
#define ALFR_STOREPATH   2
#define ALFR_MULTISELECT 4
#define ALFR_DRAWERSONLY 8

struct GetFileNameVars
{
  APTR   app;                 // MUI Application ptr
  char   *title;              // Title of filerequester
  char   *path;               // Default path..
  char   *fname;              // Default filename
  char   *result;             // The final filename (with path, volume etc..)
  ULONG  flags;               // See above..
  struct Window *win;         // Intuition window ptr

  struct FileRequester *frq;  // ** Don't touch this! **
  LONG   cnt;                 // Number of files selected
  LONG   numSelected; 
};

#define CMDID_RQ1 0x11    // Request data 1
#define CMDID_DT1 0x12    // Data set 1

struct RolandInfo
{
  UBYTE *sysExRolandHeader;
  ULONG sysExSize;
  UBYTE *addr;
  UBYTE *data;
  ULONG size;
};

// The system exclusive message is of variable length but with
// a fixed header

struct SysExRoland
{
  // $F0 Exclusive status
  
  UBYTE ManufactorID;
  UBYTE DeviceID;
  UBYTE ModelID;
  UBYTE CommandID;
  UBYTE Address[4];

  // Data follows (variable length)

  UBYTE Data[0];
  
  // $F7 End of exclusive
};

// The request data structure has fixed length

struct ReqDataRoland
{
  UBYTE SysEx;           // $F0
  UBYTE ManufactorID;    //
  UBYTE DeviceID;        // User configurable
  UBYTE ModelID;         //
  UBYTE CommandID;       // $11 (RQ1)
  UBYTE Address[4];      // MSB .. LSB (Big Endian)
  UBYTE Size[4];         // MSB .. LSB (Big Endian)
  UBYTE CheckSum;
  UBYTE SysExEnd;        // $F7 (End of exclusive)
};

#define MANUFAC_ROLAND 0x41

#define DB2V(x) ((*x[0]<<4)+*x[1])     // Makes a value out of double-byte words

/*
 * Error numbers for the alShowError() function
 *
 */

enum
{
  ERROR_NOERROR,
  ERROR_UNKNOWNFILE,
  ERROR_FILEPROBLEMS,
  ERROR_WRITEERROR,
  ERROR_TIMEOUT,
  ERROR_NODEVICE,        // OBSOLETE!
  ERROR_NOMIDIPORT,
  ERROR_SENDFAILED,
  
  ERROR_NUMOF
};  

// Structure for alGetAvailExpBoards()

struct GetFilesInfo
{
  char *dest;         // ptr to buffer containing all the collected filenames
  char **ptrs;        // ptr to array of char *. Contains ptrs to the matched filenames
  char *pattern;      // the file matching pattern
  LONG skip;          // number of bytes to skip at the start of the filenames
  LONG destSize;      // sizeof your destination buffer
  LONG ptrsElements;  // #elements in your char * array
};
  
#endif

