/*
 * $Header: main:net/WPL/logproc.h,v 1.2 93/04/12 14:37:47 Alan_Kelm Exp Locker: Alan_Kelm $
 *  New log process structures
 */

#ifndef _LOGPROC_H_

#ifndef EXEC_LISTS_H
#include <exec/nodes.h>
#include <exec/lists.h>
#endif

#ifndef EXEC_PORTS_H
#include <exec/ports.h>
#endif


#define LPNAMELEN    20
#define MAXLOGENTRY 220
#define NUMLOGS      20
#define SCRATCHLEN  256 /* must be at least as large as LPNAMELEN */
#define ADDRESSABLE   1 /* flag for line-addressable window type */
#define CSI         0x9B    /* ANSI control sequence introducer */

/* If you want to disable the line-addressable window code (including the
 * PutLine command), do a "#define SCROLL_ONLY"  here.  (Russell requested
 * this to reduce code size on options he will never use).
 */
/* #define SCROLL_ONLY */

struct LogProc {
  struct MsgPort *PublicPort;
  struct List     logHandles;
  struct List    logSessions;
  BOOL              aborting;             
  char  session[LPNAMELEN+1];  /* Session name  */
  char scratch[SCRATCHLEN+1]; /* scratch space */
};

struct LogEntry {
  struct Node le_Node;
  char buf[MAXLOGENTRY];
  long zerome; /*debugging */
};

struct logHandle {
  struct Node lplh;              /* ln_Type is always 0 */
  char        name[LPNAMELEN+1]; /* log handle name */
  long        length;            /* allocation length (AllocMem()) */
};                               /* is 0 (as flag) for Window handle */


struct logHandleW {
  struct logHandle lh;
  BPTR       myFile;
#ifndef SCROLL_ONLY
  int        winType;           /* flags: ADDRESSABLE or none */
#endif
};

struct logHandleF {
  struct logHandle lh;
  struct List logs;
  struct List freelogs;
  struct LogEntry logentries[NUMLOGS];
  char        filename[2]; /* filename goes from here */
};

struct logSession {
  struct Node lpls;
  struct List logSesNodes;  /* a list of lpSesNode structures */
  char     name[LPNAMELEN+1]; /* log handle name */
};

struct lpSesNode {
   struct Node lpsn;
   struct logHandle *handle;
};

#define _LOGPROC_H_
#endif
