phantasmal_dgd_v1/
phantasmal_dgd_v1/bin/
phantasmal_dgd_v1/doc/
phantasmal_dgd_v1/mud/doc/
phantasmal_dgd_v1/mud/doc/api/
phantasmal_dgd_v1/mud/doc/kernel/
phantasmal_dgd_v1/mud/doc/kernel/hook/
phantasmal_dgd_v1/mud/doc/kernel/lfun/
phantasmal_dgd_v1/mud/include/
phantasmal_dgd_v1/mud/include/kernel/
phantasmal_dgd_v1/mud/kernel/lib/
phantasmal_dgd_v1/mud/kernel/lib/api/
phantasmal_dgd_v1/mud/kernel/obj/
phantasmal_dgd_v1/mud/kernel/sys/
phantasmal_dgd_v1/mud/tmp/
phantasmal_dgd_v1/mud/usr/System/
phantasmal_dgd_v1/mud/usr/System/keys/
phantasmal_dgd_v1/mud/usr/System/obj/
phantasmal_dgd_v1/mud/usr/System/open/lib/
phantasmal_dgd_v1/mud/usr/common/data/
phantasmal_dgd_v1/mud/usr/common/lib/parsed/
phantasmal_dgd_v1/mud/usr/common/obj/telopt/
phantasmal_dgd_v1/mud/usr/common/obj/ustate/
phantasmal_dgd_v1/mud/usr/game/
phantasmal_dgd_v1/mud/usr/game/include/
phantasmal_dgd_v1/mud/usr/game/obj/
phantasmal_dgd_v1/mud/usr/game/object/
phantasmal_dgd_v1/mud/usr/game/object/stuff/
phantasmal_dgd_v1/mud/usr/game/sys/
phantasmal_dgd_v1/mud/usr/game/text/
phantasmal_dgd_v1/mud/usr/game/users/
phantasmal_dgd_v1/src/host/
phantasmal_dgd_v1/src/host/beos/
phantasmal_dgd_v1/src/host/mac/
phantasmal_dgd_v1/src/host/unix/
phantasmal_dgd_v1/src/host/win32/res/
phantasmal_dgd_v1/src/kfun/
phantasmal_dgd_v1/src/lpc/
phantasmal_dgd_v1/src/parser/
/*
 *   The basic data type is a line buffer, in which blocks of lines are
 * allocated. The line buffer can be made inactive, to make it use as little
 * system resources as possible.
 *   Blocks can be created, deleted, queried for their size, split in two, or
 * concatenated. Blocks are never actually deleted in a line buffer, but a
 * fake delete operation is added for the sake of completeness.
 */
typedef Int block;

typedef struct _btbuf_ {
    long offset;			/* offset in tmpfile */
    struct _btbuf_ *prev;		/* prev in linked list */
    struct _btbuf_ *next;		/* next in linked list */
    char *buf;				/* buffer with blocks and text */
} btbuf;

typedef struct {
    char *file;				/* tmpfile name */
    int fd;				/* tmpfile fd */
    char *buf;				/* current low-level buffer */
    int blksz;				/* block size in write buffer */
    int txtsz;				/* text size in write buffer */
    void (*putline) P((char*, char*));	/* output line function */
    char *context;			/* context for putline */
    bool reverse;			/* for bk_put() */
    btbuf *wb;				/* write buffer */
    btbuf bt[NR_EDBUFS];		/* read & write buffers */
} linebuf;

extern linebuf *lb_new	  P((linebuf*, char*));
extern void	lb_del	  P((linebuf*));
extern void	lb_inact  P((linebuf*));

extern block	bk_new	  P((linebuf*, char*(*)(char*), char*));
# define	bk_del(linebuf, block)	/* nothing */
extern Int	bk_size	  P((linebuf*, block));
extern void	bk_split  P((linebuf*, block, Int, block*, block*));
extern block	bk_cat	  P((linebuf*, block, block));
extern void	bk_put	  P((linebuf*, block, Int, Int, void(*)(char*, char*),
			     char*, int));