/* ---------------------------------------------------------------------- */
/*                   Copyright (C) 1991 by Natrlich!                     */
/*                      This file is copyrighted!                         */
/*                Refer to the documentation for details.                 */
/* ---------------------------------------------------------------------- */
#ifndef _BUFFER_
# define _BUFFER_

# define BUF_FILE     0
# define BUF_MACRO    1
# define BUF_UNDO     2
# define BUF_AUX      3
# define BUF_FREE     0x20
# define BUF_ALLOC    0x40
# define BUF_TOKEN    0x80
# define BUF_TYPEMASK 0x8F

/* Little routine to unhook buffer needs a helping pointer */
# if VERSION
#  define kill_buffer( hp)                                             \
     hp = bp;                   /* get buffer to be freed           */ \
     if( bp = bp->before)       /* New buffer is the one before     */ \
     {                                                                 \
        if( (hp->type ^ bp->type) & BUF_TYPEMASK)                      \
           freshflag = 1;                                              \
        bp->next = 0;           /* of course only if there was one  */ \
        gettoken = (int (*)(void)) bp->get;  /* new input routine */   \
     }                          /* **-PORT #1-** 1 line up */          \
     (*hp->done)(hp);           /* Call cleanup action (almost OO)  */ \
     if( hp->type & BUF_FREE)   /* dynamic buffer struct ? then     */ \
        nfree( (void huge *) hp); /* Remove buffer struct           */
# endif

#define inc_line()   if( bp) bp->line++
#endif
