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

#define S_RCODE         0           /* relocatable code          */
#define S_SDATA         1           /* Static data               */
#define S_RDATA         2           /* relocatable data (words)  */
#define S_TDATA         3           /* relocatable data (dbytes) */
#define S_DS            4           /* hole to leave             */
#define S_ALIGN         5           /* align code on boundary    */
#define S_RSTOP         0x40
#define S_UNKNOWN       -1
#define sis_code( x)    ((word) x->type < S_DS)
#define sis_unknown( s) ((s)->type < 0)
#define calc_index()    (p_index() - sp->index)

#if VERSION
# define check_fseg( p, t)       \
   if( runnable)                 \
   {                             \
      if( sis_unknown( p))       \
         p->type = S_SDATA; /*1*/\
   }                             \
   else                          \
      if( (t) != p->type)        \
         if( sis_unknown( p))    \
            p->type = t;         \
         else                    \
            build_rseg( t, 0)

# define check_dseg( p, t, val)  \
   if( runnable)                 \
   {                             \
      if( sis_unknown( p))       \
         p->type = S_SDATA;      \
   }                             \
   else                          \
      if( (t) != p->type)        \
         if( sis_unknown( p))    \
         {                       \
            p->type = t;         \
            p->size = val;       \
         }                       \
         else                    \
            build_rseg( t, val); \
      else                       \
         p->size += val
# endif
#endif
/* 1 :  beats me why this should be S_SDATA (probably anything is OK !?) */
