/*
**  $VER: files.e V0.9B
**
**  File definitions.
**
**  (C) Copyright 1996-1997 DreamWorld Productions.
**      All Rights Reserved
*/

OPT MODULE
OPT EXPORT
OPT PREPROCESS

MODULE 'dpkernel/dpkernel','system/register','misc/time'

/****************************************************************************
** Module information.
*/

CONST FILE_MODVERSION  = 0,
      FILE_MODREVISION = 9

/****************************************************************************
** Mini structures for source and destination operations.
*/

OBJECT filename
  id   :INT       /* ID_FILENAME */
  name :LONG      /* Pointer to filename */
ENDOBJECT

/* Memory pointer structure */

OBJECT memptr
  id      :INT      /* ID_MEMPTR */
  address :LONG     /* Pointer to memory area */
  size    :LONG     /* Must supply a size unless you are a MemBlock */
ENDOBJECT

/****************************************************************************
** File Object.
*/

CONST FILEVERSION = 1,
      TAGS_FILE   = $FFFB0000 OR ID_FILE

OBJECT file
  head[1]     :ARRAY OF head /* Standard header */
  bytepos     :LONG          /* Current position in file */
  size        :LONG          /* Total size of the file */
  flags       :LONG          /* File flags */
  source      :PTR TO head   /* Direct pointer to the original Source structure */
  prev        :PTR TO file   /* Previous file in chain */
  next        :PTR TO file   /* Next file in chain */
  comment     :PTR TO CHAR   /* Pointer to comment string */
  date        :PTR TO time   /* Set at time of creation */
  permissions :LONG          /* User permission flags */
ENDOBJECT

CONST FLA_BYTEPOS = TLONG OR 12,
      FLA_SIZE    = TLONG OR 16,
      FLA_FLAGS   = TLONG OR 20,
      FLA_SOURCE  = TAPTR OR 24,
      FLA_PREV    = TAPTR OR 28,
      FLA_NEXT    = TAPTR OR 32,
      FLA_COMMENT = TAPTR OR 36,
      FLA_DATE    = TAPTR OR 40

CONST FPT_READ     = $00000001,
      FPT_WRITE    = $00000002,
      FPT_EXECUTE  = $00000004,
      FPT_DELETE   = $00000008,
      FPT_SCRIPT   = $00000010,
      FPT_HIDDEN   = $00000020,
      FPT_ARCHIVE  = $00000040,
      FPT_PASSWORD = $00000080

/****************************************************************************
** Directory Object.
*/

CONST DIRVERSION     = 1,
      TAGS_DIRECTORY = $FFFB0000 OR ID_DIRECTORY

OBJECT directory
  head[1]     :ARRAY OF head     /* 00: Standard header */
  childdir    :PTR TO directory  /* 12: First directory in list (master only) */
  childfile   :PTR TO file       /* 16: First file in list (master only) */
  source      :PTR TO filename   /* 20: Location and Name of this directory */
  flags       :LONG              /* 24: Opening Flags (see file flags) */
  comment     :PTR TO CHAR       /* 28: Pointer to comment string */
  permissions :LONG              /* 32: User Flags */
  date        :PTR TO time       /* 36: Set to time of creation */
  next        :PTR TO directory  /* 40: Next directory in this list */
  prev        :PTR TO directory  /* 44: Previous directory in this list */
ENDOBJECT

CONST DIRA_Source      = TAPTR OR 20,
      DIRA_Flags       = TLONG OR 24,
      DIRA_Comment     = TAPTR OR 28,
      DIRA_Permissions = TLONG OR 32,
      DIRA_Date        = TAPTR OR 36

