#ifndef FILES_SEGMENTS_H
#define FILES_SEGMENTS_H TRUE

/*
**   $VER: segments.h V1.0
**
**   Segment Definitions.
**
**   (C) Copyright 1996-1998 DreamWorld Productions.
**       All Rights Reserved.
*/

#ifndef DPKERNEL_H
#include <dpkernel/dpkernel.h>
#endif

/****************************************************************************
** Segment object.
*/

#define VER_SEGMENT  1
#define TAGS_SEGMENT (ID_SPCTAGS<<16)|ID_SEGMENT

struct Segment {
  struct Head Head;        /* [00] Standard structure header */
  struct Segment *Prev;    /* [12] Previous segment */
  struct Segment *Next;    /* [16] Next segment */
  LONG   MemType;          /* [20] Memory type (eg MEM_DATA) */
  APTR   Address;          /* [24] Pointer to segment start */
  struct FileName *Source; /* [28] Source of segment */
  WORD   CPU;              /* [32] The CPU type if it is a MEM_CODE segment */

  /* Private fields below */

  APTR   prvDOSSeg;
};

#define SGA_Prev     (12|TAPTR)
#define SGA_Next     (16|TAPTR)
#define SGA_MemType  (20|TLONG)
#define SGA_Address  (24|TAPTR)
#define SGA_Source   (28|TAPTR)
#define SGA_CPU      (32|TWORD)

/****************************************************************************
** This structure is identical to the standard segment struct but defines
** the Address as a function (ANSI-C prevents function<->data type
** conversion).
*/

struct CodeSegment {
  struct Head Head;
  struct Segment *Prev;
  struct Segment *Next;
  LONG   MemType;

  #ifdef _DCC
    void (*Address)(__D0 LONG ID, __D1 LONG Version, __D2 LONG Revision,
           __A1 struct DPKBase *, __A0 BYTE *Arguments);
  #else
   #ifdef __SASC
    __asm void (*Address)(register __d0 LONG ID,
                 register __d1 LONG Version,
                 register __d2 LONG Revision,
                 register __a1 struct DPKBase *DPKBase,
                 register __a0 BYTE *Arguments);
   #else
    void (*Address)(LONG ID, LONG Version, LONG Revision, struct DPKBase *,
           BYTE *Arguments);
   #endif
  #endif

  struct FileName *Source;

  /*** Private fields below ***/

  APTR   prvDOSSeg;
};

#endif /* FILES_SEGMENTS_H */
