(*************************************************************************

     $RCSfile: Datatypes.mod $
  Description: Interface to datatypes.

   Created by: fjc (Frank Copeland)
    $Revision: 3.1 $
      $Author: fjc $
        $Date: 1994/08/08 01:16:19 $

  Includes Release 40.15

  (C) Copyright 1991-1993 Commodore-Amiga, Inc.
      All Rights Reserved

  Oberon-A Interface Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Interface.
  See Oberon-A.doc for conditions of use and distribution.

*************************************************************************)

MODULE Datatypes;

(*
** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
** $V- OvflChk       $Z- ZeroVars
*)

IMPORT
  E   := Exec,
  U   := Utility,
  D   := Dos,
  G   := Graphics,
  P   := Printer,
  IFF := IFFParse,
  I   := Intuition,
  SYS := SYSTEM;

(*
** Declare pointer types.
*)

TYPE

  DataTypeHeaderPtr * = CPOINTER TO DataTypeHeader;
  DTHookContextPtr * = CPOINTER TO DTHookContext;
  ToolPtr * = CPOINTER TO Tool;
  DataTypePtr * = CPOINTER TO DataType;
  ToolNodePtr * = CPOINTER TO ToolNode;
  SpecialInfoPtr * = CPOINTER TO SpecialInfo;
  MethodPtr * = CPOINTER TO Method;
  FrameInfoPtr * = CPOINTER TO FrameInfo;
  LinePtr * = CPOINTER TO Line;
  BitMapHeaderPtr * = CPOINTER TO BitMapHeader;
  ColorRegisterPtr * = CPOINTER TO ColorRegister;
  VoiceHeaderPtr * = CPOINTER TO VoiceHeader;
  AnimHeaderPtr * = CPOINTER TO AnimHeader;


(*
**      $VER: datatypes.h 39.6 (22.4.93)
*)

(*****************************************************************************)

CONST

  idDTYP * = 044545950H; (* MAKE_ID('D','T','Y','P') *)

(*****************************************************************************)

CONST

  idDTHD * = 044544844H; (* MAKE_ID('D','T','H','D') *)

TYPE

  DataTypeHeader * = RECORD
    name * : E.STRPTR;                                 (* Descriptive name of the data type *)
    baseName * : E.STRPTR;                             (* Base name of the data type *)
    pattern * : E.STRPTR;                              (* Match pattern for file name. *)
    mask * : CPOINTER TO INTEGER;                      (* Comparision mask *)
    groupID * : E.ULONG;                               (* Group that the DataType is in *)
    id * : E.ULONG;                                    (* ID for DataType (same as IFF FORM type) *)
    maskLen * : INTEGER;                               (* Length of comparision mask *)
    pad * : INTEGER;                                   (* Unused at present (must be 0) *)
    flags * : E.WSET;                                 (* Flags *)
    priority * : E.UWORD;                              (* Priority *)
  END;

(*****************************************************************************)

CONST

(* Basic type *)
  typeMask * = 0000FH;
  binary * = 00000H;
  ascii * = 00001H;
  iff * = 00002H;
  misc * = 00003H;

(* Set if case is important *)
  case * = 00010H;

(* Reserved for system use *)
  system1 * = 01000H;

(*****************************************************************************
 *
 * GROUP ID and ID
 *
 * This is used for filtering out objects that you don't want.  For
 * example, you could make a filter for the ASL file requester so
 * that it only showed the files that were pictures, or even to
 * narrow it down to only show files that were ILBM pictures.
 *
 * Note that the Group ID's are in lower case, and always the first
 * four characters of the word.
 *
 * For ID's; If it is an IFF file, then the ID is the same as the
 * FORM type.  If it isn't an IFF file, then the ID would be the
 * first four characters of name for the file type.
 *
 *****************************************************************************)

CONST

(* System file, such as; directory, executable, library, device, font, etc. *)
  gidSystem * = 073797374H; (* MAKE_ID ('s','y','s','t') *)

(* Formatted or unformatted text *)
  gidText * = 074657874H; (* MAKE_ID ('t','e','x','t') *)

(* Formatted text with graphics or other DataTypes *)
  gidDocument * = 0646F6375H; (* MAKE_ID ('d','o','c','u') *)

(* Sound *)
  gidSound * = 0736F756EH; (* MAKE_ID ('s','o','u','n') *)

(* Musical instruments used for musical scores *)
  gidInstrument * = 0696E7374H; (* MAKE_ID ('i','n','s','t') *)

(* Musical score *)
  gidMusic * = 06D757369H; (* MAKE_ID ('m','u','s','i') *)

(* Still picture *)
  gidPicture * = 070696374H; (* MAKE_ID ('p','i','c','t') *)

(* Animated picture *)
  gidAnimation * = 0616E696DH; (* MAKE_ID ('a','n','i','m') *)

(* Animation with audio track *)
  gidMovie * = 06D6F7669H; (* MAKE_ID ('m','o','v','i') *)

(*****************************************************************************)

CONST

(* A code chunk contains an embedded executable that can be loaded
 * with InternalLoadSeg. *)
  idCode * = 044544344H; (* MAKE_ID('D','T','C','D') *)

TYPE

(* DataTypes comparision hook context (Read-Only).  This is the
 * argument that is passed to a custom comparision routine. *)

  DTHookContext * = RECORD
    (* Libraries that are already opened for your use *)
    sysBase - : E.LibraryPtr;
    dosBase - : D.DosLibraryPtr;
    iffParseBase - : IFF.IffParseBasePtr;
    utilityBase - : U.UtilityBasePtr;

    (* File context *)
    lock - : D.FileLockPtr;                                   (* Lock on the file *)
    fib - : D.FileInfoBlockPtr;                          (* Pointer to a FileInfoBlock *)
    fileHandle - : D.FileHandlePtr;                             (* Pointer to the file handle (may be NULL) *)
    iff - : IFF.IFFHandlePtr;                              (* Pointer to an IFFHandle (may be NULL) *)
    buffer - : E.STRPTR;                               (* Buffer *)
    bufferLength - : E.ULONG;                          (* Length of the buffer *)
  END;

(*****************************************************************************)

CONST

  idTool * = 04454544CH; (* MAKE_ID('D','T','T','L'); *)

TYPE

  Tool * = RECORD
    which * : E.UWORD;                                 (* Which tool is this *)
    flags * : E.WSET;                                 (* Flags *)
    program * : E.STRPTR;                              (* Application to use *)
  END;

CONST

(* defines for tn_Which *)
  twInfo * = 1;
  twBrowse * = 2;
  twEdit * = 3;
  twPrint * = 4;
  twMail * = 5;

(* defines for tn_Flags *)
  tfLaunchMask * = 0000FH;
  tfShell * = 00001H;
  tfWorkbench * = 00002H;
  tfRx * = 00003H;

(*****************************************************************************)

CONST

  idTags * = 044545447H; (* MAKE_ID('D','T','T','G'); *)

(*****************************************************************************)

TYPE

  DataType * = RECORD
    node1 * : E.Node;                                    (* Reserved for system use *)
    node2 * : E.Node;                                    (* Reserved for system use *)
    header * : DataTypeHeaderPtr;                      (* Pointer to the DataTypeHeader *)
    toolList * : E.List;                                 (* List of tool nodes *)
    functionName * : E.STRPTR;                         (* Name of comparision routine *)
    attrList * : U.TagListPtr;                           (* Object creation tags *)
    length * : E.ULONG;                                (* Length of the memory block *)
  END;

(*****************************************************************************)

TYPE

  ToolNode * = RECORD (E.Node)                         (* Embedded node *)
    tool * : Tool;                                     (* Embedded tool *)
    length * : E.ULONG;                                (* Length of the memory block *)
  END;

(*****************************************************************************)

CONST

  idNAME * = 04E414D45H; (* MAKE_ID('N','A','M','E') *)

(*****************************************************************************)

CONST

(* text ID's *)
  errorUnknownDatatype * = 2000;
  errorCouldntSave * = 2001;
  errorCouldntOpen * = 2002;
  errorCouldntSendMessage * = 2003;

(* new for V40 *)
  errorCouldntOpenClipboard * = 2004;
  errorReserved * = 2005;
  errorUnknownCompression * = 2006;
  errorNotEnoughData * = 2007;
  errorInvalidData * = 2008;

(* Offset for types *)
  msgTypeOffset * = 2100;

(*****************************************************************************)

(*
**  $VER: datatypesclass.h 39.8 (17.3.93)
**
**  Interface definitions for DataType objects.
*)

(*****************************************************************************)

CONST

  dataTypesClass * = "datatypesclass";

(*****************************************************************************)

CONST

  dtaDummy * = U.tagUser + 01000H;

(* Generic attributes *)
  dtaTextAttr * = dtaDummy+10;
        (* (struct TextAttr * ) Pointer to the default TextAttr to use for
         * the text within the object. *)

  dtaTopVert * = dtaDummy+11;
        (* (LONG) Current top vertical unit *)

  dtaVisibleVert * = dtaDummy+12;
        (* (LONG) Number of visible vertical units *)

  dtaTotalVert * = dtaDummy+13;
        (* (LONG) Total number of vertical units *)

  dtaVertUnit * = dtaDummy+14;
        (* (LONG) Number of pixels per vertical unit *)

  dtaTopHoriz * = dtaDummy+15;
        (* (LONG) Current top horizontal unit *)

  dtaVisibleHoriz * = dtaDummy+16;
        (* (LONG)  Number of visible horizontal units *)

  dtaTotalHoriz * = dtaDummy+17;
        (* (LONG) Total number of horizontal units *)

  dtaHorizUnit * = dtaDummy+18;
        (* (LONG) Number of pixels per horizontal unit *)

  dtaNodeName * = dtaDummy+19;
        (* (UBYTE * ) Name of the current element within the object. *)

  dtaTitle * = dtaDummy+20;
        (* (UBYTE * ) Title of the object. *)

  dtaTriggerMethods * = dtaDummy+21;
        (* (struct DTMethod * ) Pointer to a NULL terminated array of
         * supported trigger methods. *)

  dtaData * = dtaDummy+22;
        (* (APTR) Object specific data. *)

  dtaTextFont * = dtaDummy+23;
        (* (struct TextFont * ) Default font to use for text within the
         * object. *)

  dtaMethods * = dtaDummy+24;
        (* (ULONG * ) Pointer to a ~0 terminated array of supported
         * methods. *)

  dtaPrinterStatus * = dtaDummy+25;
        (* (LONG) Printer error message.  Error numbers are defined in
         * <devices/printer.h> *)

  dtaPrinterProc * = dtaDummy+26;
        (* PRIVATE (struct Process * ) Pointer to the print process. *)

  dtaLayoutProc * = dtaDummy+27;
        (* PRIVATE (struct Process * ) Pointer to the layout process. *)

  dtaBusy * = dtaDummy+28;
        (* Used to turn the applications' busy pointer off and on *)

  dtaSync * = dtaDummy+29;
        (* Used to indicate that new information has been loaded into
         * an object.  This is for models that cache the DTA_TopVert-
         * like tags *)

  dtaBaseName * = dtaDummy+30;
        (* The base name of the class *)

  dtaGroupID * = dtaDummy+31;
        (* Group that the object must belong in *)

  dtaErrorLevel * = dtaDummy+32;
        (* Error level *)

  dtaErrorNumber * = dtaDummy+33;
        (* datatypes.library error number *)

  dtaErrorString * = dtaDummy+34;
        (* Argument for datatypes.library error *)

  dtaConductor * = dtaDummy+35;
        (* New for V40. (UBYTE * ) specifies the name of the
         * realtime.library conductor.  Defaults to "Main". *)

  dtaControlPanel * = dtaDummy+36;
        (* New for V40. (BOOL) Indicate whether a control panel should be
         * embedded within the object (in the animation datatype, for
         * example).  Defaults to TRUE. *)

  dtaImmediate * = dtaDummy+37;
        (* New for V40. (BOOL) Indicate whether the object should
         * immediately begin playing.  Defaults to FALSE. *)

  dtaRepeat * = dtaDummy+38;
        (* New for V40. (BOOL) Indicate that the object should repeat
         * playing.  Defaults to FALSE. *)


(* DTObject attributes *)
  dtaName * = dtaDummy+100;
  dtaSourceType * = dtaDummy+101;
  dtaHandle * = dtaDummy+102;
  dtaDataType * = dtaDummy+103;
  dtaDomain * = dtaDummy+104;

(* DON'T USE THE FOLLOWING FOUR TAGS.  USE THE CORRESPONDING TAGS IN
 * <intuition/gadgetclass.h> *)
  dtaLeft * = dtaDummy+105;
  dtaTop * = dtaDummy+106;
  dtaWidth * = dtaDummy+107;
  dtaHeight * = dtaDummy+108;

  dtaObjName * = dtaDummy+109;
  dtaObjAuthor * = dtaDummy+110;
  dtaObjAnnotation * = dtaDummy+111;
  dtaObjCopyright * = dtaDummy+112;
  dtaObjVersion * = dtaDummy+113;
  dtaObjectID * = dtaDummy+114;
  dtaUserData * = dtaDummy+115;
  dtaFrameInfo * = dtaDummy+116;

(* DON'T USE THE FOLLOWING FOUR TAGS.  USE THE CORRESPONDING TAGS IN
 * <intuition/gadgetclass.h> *)
  dtaRelRight * = dtaDummy+117;
  dtaRelBottom * = dtaDummy+118;
  dtaRelWidth * = dtaDummy+119;
  dtaRelHeight * = dtaDummy+120;

  dtaSelectDomain * = dtaDummy+121;
  dtaTotalPVert * = dtaDummy+122;
  dtaTotalPHoriz * = dtaDummy+123;
  dtaNominalVert * = dtaDummy+124;
  dtaNominalHoriz * = dtaDummy+125;

(* Printing attributes *)
  dtaDestCols * = dtaDummy+400;
        (* (LONG) Destination X width *)

  dtaDestRows * = dtaDummy+401;
        (* (LONG) Destination Y height *)

  dtaSpecial * = dtaDummy+402;
        (* (UWORD) Option flags *)

  dtaRastPort * = dtaDummy+403;
        (* (struct RastPort * ) RastPort to use when printing. (V40) *)

  dtaARexxPortName * = dtaDummy+404;
        (* (STRPTR) Pointer to base name for ARexx port (V40) *)


(*****************************************************************************)

  stRam * = 1;
  stFile * = 2;
  stClipboard * = 3;
  stHotlink * = 4;

(*****************************************************************************)

TYPE

(* Attached to the Gadget.SpecialInfo field of the gadget.  Don't access directly,
 * use the Get/Set calls instead.
 *)
  SpecialInfo * = RECORD
    lock * :  E.SignalSemaphore;                  (* Locked while in DoAsyncLayout() *)
    flags * :  SET;

    topVert * :  LONGINT;                       (* Top row (in units) *)
    visVert * :  LONGINT;                       (* Number of visible rows (in units) *)
    totVert * :  LONGINT;                       (* Total number of rows (in units) *)
    oTopVert * :  LONGINT;                      (* Previous top (in units) *)
    vertUnit * :  LONGINT;                      (* Number of pixels in vertical unit *)

    topHoriz * :  LONGINT;                      (* Top column (in units) *)
    visHoriz * :  LONGINT;                      (* Number of visible columns (in units) *)
    totHoriz * :  LONGINT;                      (* Total number of columns (in units) *)
    oTopHoriz * :  LONGINT;                     (* Previous top (in units) *)
    horizUnit * :  LONGINT;                     (* Number of pixels in horizontal unit *)
  END;

CONST

(* Object is in layout processing *)
  siLayout * = 0;

(* Object needs to be layed out *)
  siNewSize * = 1;

  siDragging * = 2;
  siDragSelect * = 3;

  siHighlight * = 4;

(* Object is being printed *)
  siPrinting * = 5;

(* Object is in layout process *)
  siLayoutProc * = 6;

(*****************************************************************************)

TYPE

  Method * = RECORD
    label * :  E.STRPTR;
    command * :  E.STRPTR;
    method * :  E.ULONG;
  END;

(*****************************************************************************)

CONST

  dtmDummy * = 0600H;

(* Inquire what environment an object requires *)
  dtmFrameBox * = 0601H;

(* Same as GM_LAYOUT except guaranteed to be on a process already *)
  dtmProcLayout * = 0602H;

(* Layout that is occurring on a process *)
  dtmASyncLayout * = 0603H;

(* When a RemoveDTObject() is called *)
  dtmRemoveDTObject * = 0604H;

  dtmSelect * = 0605H;
  dtmClearSelected * = 0606H;

  dtmCopy * = 0607H;
  dtmPrint * = 0608H;
  dtmAbortPrint * = 0609H;

  dtmNewMember * = 0610H;
  dtmDisposeMember * = 0611H;

  dtmGoto * = 0630H;
  dtmTrigger * = 0631H;

  dtmObtainDrawInfo * = 0640H;
  dtmDraw * = 0641H;
  dtmReleaseDrawInfo * = 0642H;

  dtmWrite * = 0650H;

TYPE
(* Used to ask the object about itself *)
  FrameInfo * = RECORD
    propertyFlags * : LONGINT;                         (* DisplayInfo (graphics/displayinfo.h) *)
    resolution * : G.Point;                              (* DisplayInfo *)

    redBits * : E.UBYTE;
    greenBits * : E.UBYTE;
    blueBits * : E.UBYTE;

    dimensions * : RECORD
      width * : E.ULONG;
      height * : E.ULONG;
      depth * : E.ULONG;
    END;

    screen * : I.ScreenPtr;
    colorMap * : G.ColorMapPtr;

    flags * : SET;
  END;

CONST

  fiScalable * = 1;
  fiScrollable * = 2;
  fiRemappable * = 4;

TYPE

(* DTM_REMOVEDTOBJECT, DTM_CLEARSELECTED, DTM_COPY, DTM_ABORTPRINT *)
  General * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
  END;

(* DTM_SELECT *)
  Select * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    select * : G.Rectangle;
  END;

(* DTM_FRAMEBOX *)
  FrameBox * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    contentsInfo * : FrameInfoPtr;             (* Input *)
    frameInfo * : FrameInfoPtr;                (* Output *)
    sizeFrameInfo * : E.ULONG;
    frameFlags * : SET;
  END;

CONST

  frameSpecify * = 0;     (* Make do with the dimensions of FrameBox provided. *)

TYPE

(* DTM_GOTO *)
  Goto * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    nodeName * : E.STRPTR;                     (* Node to goto *)
    attrList * : U.TagListPtr;                   (* Additional attributes *)
  END;

(* DTM_TRIGGER *)
  Trigger * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    function * : E.ULONG;
    data * : E.APTR;
  END;

CONST

  stmPause * = 1;
  stmPlay * = 2;
  stmContents * = 3;
  stmIndex * = 4;
  stmRetrace * = 5;
  stmBrowsePrev * = 6;
  stmBrowseNext * = 7;

  stmNextField * = 8;
  stmPrevField * = 9;
  stmActivateField * = 10;

  stmCommand * = 11;

(* New for V40 *)
  stmRewind * = 12;
  stmFastForward * = 13;
  stmStop * = 14;
  stmResume * = 15;
  stmLocate * = 16;

TYPE

(* DTM_PRINT *)
  PrintStd * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    pio * : E.IOStdReqPtr;
    attrList * : U.TagListPtr;
  END;

  PrintDRP * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    pio * : P.IODRPReqPtr;
    attrList * : U.TagListPtr;
  END;

  PrintPrtCmd * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;
    pio * : P.IOPrtCmdReqPtr;
    attrList * : U.TagListPtr;
  END;

(* DTM_DRAW *)
  Draw * = RECORD (I.Msg)
    rPort * : G.RastPortPtr;
    left * : LONGINT;
    top * : LONGINT;
    width * : LONGINT;
    height * : LONGINT;
    topHoriz * : LONGINT;
    topVert * : LONGINT;
    attrList * : U.TagListPtr;                   (* Additional attributes *)
  END;

(* DTM_WRITE *)
  Write * = RECORD (I.Msg)
    gInfo * : I.GadgetInfoPtr;                   (* Gadget information *)
    fileHandle * : D.FileHandlePtr;                     (* File handle to write to *)
    mode * : E.ULONG;
    attrList * : U.TagListPtr;                   (* Additional attributes *)
  END;

CONST

(* Save data as IFF data *)
  wmIff * = 0;

(* Save data as local data format *)
  wmRaw * = 1;

(*
**  $VER: textclass.h 39.3 (3.8.92)
**
**  Interface definitions for DataType text objects.
*)

(*****************************************************************************)

CONST

  textDTClass * = "text.datatype";

(*****************************************************************************)

CONST

(* Text attributes *)
  tdtaBuffer * = dtaDummy + 300;
  tdtaBufferLen * = dtaDummy + 301;
  tdtaLineList * = dtaDummy + 302;
  tdtaWordSelect * = dtaDummy + 303;
  tdtaWordDelim * = dtaDummy + 304;
  tdtaWordWrap * = dtaDummy + 305;
     (* Boolean. Should the text be word wrapped.  Defaults to false. *)

(*****************************************************************************)

TYPE

(* There is one Line structure for every line of text in our document.  *)
  Line * = RECORD (E.MinNode)                   (* to link the lines together *)
    text * :  E.STRPTR;                         (* pointer to the text for this line *)
    textLen * :  E.ULONG;                       (* the character length of the text for this line *)
    xOffset * :  E.UWORD;                       (* where in the line the text starts *)
    yOffset * :  E.UWORD;                       (* line the text is on *)
    width * :  E.UWORD;                         (* Width of line in pixels *)
    height * :  E.UWORD;                        (* Height of line in pixels *)
    flags * :  E.WSET;                         (* info on the line *)
    fgPen * :  SHORTINT;                        (* foreground pen *)
    bgPen * :  SHORTINT;                        (* background pen *)
    style * :  SET;                         (* Font style *)
    data * :  E.APTR;                           (* Link data... *)
  END;

(*****************************************************************************)

(* Line.ln_Flags *)

CONST

(* Line Feed *)
  lnLF * = 0;

(* Segment is a link *)
  lnLink * = 1;

(* ln_Data is a pointer to an DataTypes object *)
  lnObject * = 2;

(* Object is selected *)
  lnSelected * = 3;

(*****************************************************************************)

CONST

(* IFF types that may be text *)
  idFTXT * = 046545854H; (* MAKE_ID('F','T','X','T') *)
  idCHRS * = 043485253H; (* MAKE_ID('C','H','R','S') *)

(*****************************************************************************)

(*
**  $VER: pictureclass.h 39.5 (28.4.93)
**
**  Interface definitions for DataType picture objects.
*)

(*****************************************************************************)

CONST

  pictureDTClass * = "picture.datatype";

(*****************************************************************************)

CONST

(* Picture attributes *)
  pdtaModeID * = dtaDummy + 200;
        (* Mode ID of the picture *)

  pdtaBitMapHeader * = dtaDummy + 201;

  pdtaBitMap * = dtaDummy + 202;
        (* Pointer to a class-allocated bitmap, that will end
         * up being freed by picture.class when DisposeDTObject()
         * is called *)

  pdtaColorRegisters * = dtaDummy + 203;
  pdtaCRegs * = dtaDummy + 204;
  pdtaGRegs * = dtaDummy + 205;
  pdtaColorTable * = dtaDummy + 206;
  pdtaColorTable2 * = dtaDummy + 207;
  pdtaAllocated * = dtaDummy + 208;
  pdtaNumColors * = dtaDummy + 209;
  pdtaNumAlloc * = dtaDummy + 210;

  pdtaRemap * = dtaDummy + 211;
        (* Boolean : Remap picture (defaults to TRUE) *)

  pdtaScreen * = dtaDummy + 212;
        (* Screen to remap to *)

  pdtaFreeSourceBitMap * = dtaDummy + 213;
        (* Boolean : Free the source bitmap after remapping *)

  pdtaGrab * = dtaDummy + 214;
        (* Pointer to a Point structure *)

  pdtaDestBitMap * = dtaDummy + 215;
        (* Pointer to the destination (remapped) bitmap *)

  pdtaClassBitMap * = dtaDummy + 216;
        (* Pointer to class-allocated bitmap, that will end
         * up being freed by the class after DisposeDTObject()
         * is called *)

  pdtaNumSparse * = dtaDummy + 217;
        (* (UWORD) Number of colors used for sparse remapping *)

  pdtaSparseTable * = dtaDummy + 218;
        (* (UBYTE * ) Pointer to a table of pen numbers indicating
         * which colors should be used when remapping the image.
         * This array must contain as many entries as there
         * are colors specified with PDTA_NumSparse *)

(*****************************************************************************)

CONST

(*  Masking techniques  *)
  mskNone * = 0;
  mskHasMask * = 1;
  mskHasTransparentColor * = 2;
  mskLasso * = 3;
  mskHasAlpha * = 4;

(*  Compression techniques  *)
  cmpNone * = 0;
  cmpByteRun1 * = 1;
  cmpByteRun2 * = 2;

TYPE

(*  Bitmap header (BMHD) structure  *)
  BitMapHeader * = RECORD
    width * :  E.UWORD;                 (* Width in pixels *)
    height * :  E.UWORD;                (* Height in pixels *)
    left * :  INTEGER;                  (* Left position *)
    top * :  INTEGER;                   (* Top position *)
    depth * :  E.UBYTE;                 (* Number of planes *)
    masking * :  E.UBYTE;               (* Masking type *)
    compression * :  E.UBYTE;           (* Compression type *)
    pad * :  E.UBYTE;
    transparent * :  E.UWORD;           (* Transparent color *)
    xAspect * :  E.UBYTE;
    yAspect * :  E.UBYTE;
    pageWidth * :  INTEGER;
    pageHeight * :  INTEGER;
  END;

(*****************************************************************************)

TYPE

(*  Color register structure *)
  ColorRegister * = RECORD
    red *, green *, blue * :  E.UBYTE;
  END;

(*****************************************************************************)

CONST

(* IFF types that may be in pictures *)
  idILBM * = 0494C424DH; (* MAKE_ID('I','L','B','M') *)
  idBMHD * = 0424D4844H; (* MAKE_ID('B','M','H','D') *)
  idBODY * = 0424F4459H; (* MAKE_ID('B','O','D','Y') *)
  idCMAP * = 0434D4150H; (* MAKE_ID('C','M','A','P') *)
  idCRNG * = 043524E47H; (* MAKE_ID('C','R','N','G') *)
  idGRAB * = 047524142H; (* MAKE_ID('G','R','A','B') *)
  idSPRT * = 053535254H; (* MAKE_ID('S','P','R','T') *)
  idDEST * = 044455354H; (* MAKE_ID('D','E','S','T') *)
  idCAMG * = 043414D47H; (* MAKE_ID('C','A','M','G') *)

(*
**  $VER: soundclass.h 39.3 (26.4.93)
**
**  Interface definitions for DataType sound objects.
*)

(*****************************************************************************)

CONST

  soundDTClass * = "sound.datatype";

(*****************************************************************************)

CONST

(* Sound attributes *)
  sdtaDummy * = dtaDummy + 500;
  sdtaVoiceHeader * = sdtaDummy + 1;
  sdtaSample * = sdtaDummy + 2;
   (* (UBYTE * ) Sample data *)

  sdtaSampleLength * = sdtaDummy + 3;
   (* (ULONG) Length of the sample data in UBYTEs *)

  sdtaPeriod * = sdtaDummy + 4;
    (* (UWORD) Period *)

  sdtaVolume * = sdtaDummy + 5;
    (* (UWORD) Volume.  Range from 0 to 64 *)

  sdtaCycles * = sdtaDummy + 6;

(* The following tags are new for V40 *)
  sdtaSignalTask * = sdtaDummy + 7;
    (* (struct Task * ) Task to signal when sound is complete or
        next buffer needed. *)

  sdtaSignalBit * = sdtaDummy + 8;
    (* (BYTE) Signal bit to use on completion or -1 to disable *)

  sdtaContinuous * = sdtaDummy + 9;
    (* (ULONG) Playing a continuous stream of data.  Defaults to
        FALSE. *)

(*****************************************************************************)

CONST

  (* cmpNone * = 0; *)
  cmpFIBDelta * = 1;

TYPE

  VoiceHeader * = RECORD
    oneShotHiSamples * :  E.ULONG;
    repeatHiSamples * :  E.ULONG;
    samplesPerHiCycle * :  E.ULONG;
    samplesPerSec * :  E.UWORD;
    octaves * :  E.UBYTE;
    compression * :  E.UBYTE;
    volume * :  E.ULONG;
  END;

(*****************************************************************************)

CONST

(* IFF types *)
  id8SVX * = 038535658H; (* MAKE_ID('8','S','V','X') *)
  idVHDR * = 056484452H; (* MAKE_ID('V','H','D','R') *)
  (* idBODY * = 0424F4459H; (* MAKE_ID('B','O','D','Y') *) *)

(*****************************************************************************)

(*
**  $VER: animationclass.h 40.1 (4.5.93)
**
**  Interface definitions for DataType animation objects.
*)

(*****************************************************************************)

CONST

  animationDTClass * = "animation.datatype";

(*****************************************************************************)

CONST

(* Animation attributes *)
  adtaDummy * = dtaDummy + 600;
  adtaModeID * = pdtaModeID;
  adtaKeyFrame * = pdtaBitMap;
        (* (struct BitMap * ) Key frame (first frame) bitmap *)

  adtaColorRegisters * = pdtaColorRegisters;
  adtaCRegs * = pdtaCRegs;
  adtaGRegs * = pdtaGRegs;
  adtaColorTable * = pdtaColorTable;
  adtaColorTable2 * = pdtaColorTable2;
  adtaAllocated * = pdtaAllocated;
  adtaNumColors * = pdtaNumColors;
  adtaNumAlloc * = pdtaNumAlloc;

  adtaRemap * = pdtaRemap;
        (* (BOOL) : Remap animation (defaults to TRUE) *)

  adtaScreen * = pdtaScreen;
        (* (struct Screen * ) Screen to remap to *)

  adtaNumSparse * = pdtaNumSparse;
        (* (UWORD) Number of colors used for sparse remapping *)

  adtaSparseTable * = pdtaSparseTable;
        (* (UBYTE * ) Pointer to a table of pen numbers indicating
         * which colors should be used when remapping the image.
         * This array must contain as many entries as there
         * are colors specified with ADTA_NumSparse *)

  adtaWidth * = adtaDummy + 1;
  adtaHeight * = adtaDummy + 2;
  adtaDepth * = adtaDummy + 3;
  adtaFrames * = adtaDummy + 4;
        (* (ULONG) Number of frames in the animation *)

  adtaFrame * = adtaDummy + 5;
        (* (ULONG) Current frame *)

  adtaFramesPerSecond * = adtaDummy + 6;
        (* (ULONG) Frames per second *)

  adtaFrameIncrement * = adtaDummy + 7;
        (* (LONG) Amount to change frame by when fast forwarding or
         * rewinding.  Defaults to 10. *)

(* Sound attributes *)
  adtaSample * = sdtaSample;
  adtaSampleLength * = sdtaSampleLength;
  adtaPeriod * = sdtaPeriod;
  adtaVolume * = sdtaVolume;
  adtaCycles * = sdtaCycles;

(*****************************************************************************)

CONST

  idANIM * = 0414E494DH; (* MAKE_ID('A','N','I','M') *)
  idANHD * = 0414E4844H; (* MAKE_ID('A','N','H','D') *)
  idDLTA * = 0444C5341H; (* MAKE_ID('D','L','T','A') *)

(*****************************************************************************)

TYPE

(*  Required ANHD structure describes an ANIM frame *)
  AnimHeader * = RECORD
    operation * : E.UBYTE;     (*  The compression method:
                                     0  set directly (normal ILBM BODY),
                                     1  XOR ILBM mode,
                                     2  Long Delta mode,
                                     3  Short Delta mode,
                                     4  Generalized short/long Delta mode,
                                     5  Byte Vertical Delta mode
                                     6  Stereo op 5 (third party)
                                    74  (ascii 'J') reserved for Eric Graham's
                                        compression technique (details to be
                                        released later). *)

    mask * : E.BSET;          (* (XOR mode only - plane mask where each
                                   bit is set =1 if there is data and =0
                                   if not.) *)

    width * : E.UWORD;         (* (XOR mode only - width and height of the *)
    height * : E.UWORD;        (* area represented by the BODY to eliminate *)
                                (* unnecessary un-changed data *)


    left * : INTEGER;          (* (XOR mode only - position of rectangular *)
    top * : INTEGER;           (* area representd by the BODY) *)


    absTime * : E.ULONG;       (* Timing for a frame relative to the time
                                   the first frame was displayed, in
                                   jiffies (1/60 sec) *)

    relTime * : E.ULONG;       (* Timing for frame relative to time
                                   previous frame was displayed - in
                                   jiffies (1/60 sec) *)

    interleave * : E.UBYTE;    (* Indicates how may frames back this data is to
                                   modify.  0 defaults to indicate two frames back
                                   (for double buffering). n indicates n frames back.
                                   The main intent here is to allow values
                                   of 1 for special applications where
                                   frame data would modify the immediately
                                   previous frame. *)

    pad0 * : E.UBYTE;          (* Pad byte, not used at present. *)

    flags * : SET;         (* 32 option bits used by options=4 and 5.
                                   At present only 6 are identified, but the
                                   rest are set =0 so they can be used to
                                   implement future ideas.  These are defined
                                   for option 4 only at this point.  It is
                                   recommended that all bits be set =0 for
                                   option 5 and that any bit settings
                                   used in the future (such as for XOR mode)
                                   be compatible with the option 4
                                   bit settings.   Player code should check
                                   undefined bits in options 4 and 5 to assure
                                   they are zero.

                                   The six bits for current use are:

                                    bit #       set =0                  set =1
                                    ===============================================
                                    0           short data              long data
                                    1           set                     XOR
                                    2           separate info           one info list
                                                for each plane          for all planes
                                    3           not RLC                 RLC (run length coded)
                                    4           horizontal              vertical
                                    5           short info offsets      long info offsets
                                *)

    pad * : ARRAY 16 OF E.UBYTE; (* This is a pad for future use for future
                                   compression modes. *)
  END;

(*****************************************************************************)

CONST

  adtmDummy * = 0700H;

  adtmLoadFrame * = 0701H;
    (* Used to load a frame of the animation *)

  adtmUnloadFrame * = 0702H;
    (* Used to unload a frame of the animation *)

  adtmStart * = 0703H;
    (* Used to start the animation *)

  adtmPause * = 0704H;
    (* Used to pause the animation (don't reset the timer) *)

  adtmStop * = 0705H;
    (* Used to stop the animation *)

  adtmLocate * = 0706H;
    (* Used to locate a frame in the animation (as set by a slider...) *)

(*****************************************************************************)

TYPE

(* ADTM_LOADFRAME, ADTM_UNLOADFRAME *)

  Frame * = RECORD (I.Msg)
    timeStamp * : E.ULONG;                     (* Timestamp of frame to load *)

    (* The following fields are filled in by the ADTM_LOADFRAME method, *)
    (* and are read-only for any other methods. *)

    frame * : E.ULONG;                         (* Frame number *)
    duration * : E.ULONG;                      (* Duration of frame *)

    bitMap * : G.BitMapPtr;                      (* Loaded BitMap *)
    cMap * : G.ColorMapPtr;                      (* Colormap, if changed *)

    sample * : E.APTR;           (* Sound data *)
    sampleLength * : E.ULONG;
    period * : E.ULONG;

    userData * : E.APTR;                       (* Used by load frame for extra data *)
  END;

(* ADTM_START, ADTM_PAUSE, ADTM_STOP, ADTM_LOCATE *)
  Start * = RECORD (I.Msg)
    frame * : E.ULONG;                         (* Frame # to start at *)
  END;

(*****************************************************************************)


(* --- Library Base variable ------------------------------------------- *)

CONST

  name * = "datatypes.library";

TYPE

  DatatypesBasePtr* = CPOINTER TO DatatypesBase;
  DatatypesBase* = RECORD (E.Library) END;

VAR

  base* : DatatypesBasePtr;


(*-- Library Functions ------------------------------------------------*)

TYPE (* Return type for GetDTMethods() *)

  MethodArrayPtr * = CPOINTER TO ARRAY 32767 OF LONGINT;

(*--- functions in V40 or higher (Release 3.1) ---*)

(* Public entries *)

LIBCALL (base : DatatypesBasePtr) ObtainDataTypeA *
  ( type   [0] : E.ULONG;
    handle [8] : E.APTR;
    attrs  [9] : ARRAY OF U.TagItem )
  : DataTypePtr;
  -36;

LIBCALL (base : DatatypesBasePtr) ObtainDataType *
  ( type   [0]  : E.ULONG;
    handle [8]  : E.APTR;
    attrs  [9]..: U.Tag )
  : DataTypePtr;
  -36;

LIBCALL (base : DatatypesBasePtr) ReleaseDataType *
  ( dt [8] : DataTypePtr );
  -42;

LIBCALL (base : DatatypesBasePtr) NewDTObjectA *
  ( name  [0] : E.APTR;
    attrs [8] : ARRAY OF U.TagItem )
  : I.ObjectPtr;
  -48;

LIBCALL (base : DatatypesBasePtr) NewDTObject *
  ( name  [0]  : E.APTR;
    attrs [8]..: U.Tag )
  : I.ObjectPtr;
  -48;

LIBCALL (base : DatatypesBasePtr) DisposeDTObject *
  ( o [8] : I.ObjectPtr );
  -54;

LIBCALL (base : DatatypesBasePtr) SetDTAttrsA *
  ( o      [8] : I.ObjectPtr;
    win    [9] : I.WindowPtr;
    req   [10] : I.RequesterPtr;
    attrs [11] : ARRAY OF U.TagItem )
  : E.ULONG;
  -60;

LIBCALL (base : DatatypesBasePtr) SetDTAttrs *
  ( o      [8]  : I.ObjectPtr;
    win    [9]  : I.WindowPtr;
    req   [10]  : I.RequesterPtr;
    attrs [11]..: U.Tag )
  : E.ULONG;
  -60;

LIBCALL (base : DatatypesBasePtr) GetDTAttrsA *
  ( o      [8] : I.ObjectPtr;
    attrs [10] : ARRAY OF U.TagItem )
  : E.ULONG;
  -66;

LIBCALL (base : DatatypesBasePtr) GetDTAttrs *
  ( o      [8]  : I.ObjectPtr;
    attrs [10]..: U.Tag )
  : E.ULONG;
  -66;

LIBCALL (base : DatatypesBasePtr) AddDTObject *
  ( win [8] : I.WindowPtr;
    req [9] : I.RequesterPtr;
    o  [10] : I.ObjectPtr;
    pos [0] : LONGINT )
  : LONGINT;
  -72;

LIBCALL (base : DatatypesBasePtr) RefreshDTObjectA *
  ( o      [8] : I.ObjectPtr;
    win    [9] : I.WindowPtr;
    req   [10] : I.RequesterPtr;
    attrs [11] : ARRAY OF U.TagItem );
  -78;

LIBCALL (base : DatatypesBasePtr) RefreshDTObject *
  ( o      [8]  : I.ObjectPtr;
    win    [9]  : I.WindowPtr;
    req   [10]  : I.RequesterPtr;
    attrs [11]..: U.Tag );
  -78;

LIBCALL (base : DatatypesBasePtr) DoAsyncLayout *
  ( o   [8] : I.ObjectPtr;
    gpl [9] : I.LayoutPtr )
  : E.ULONG;
  -84;

LIBCALL (base : DatatypesBasePtr) DoDTMethodA *
  ( o        [8] : I.ObjectPtr;
    win      [9] : I.WindowPtr;
    req     [10] : I.RequesterPtr;
    VAR msg [11] : I.Msg )
  : E.ULONG;
  -90;

LIBCALL (base : DatatypesBasePtr) DoDTMethod *
  ( o    [8]  : I.ObjectPtr;
    win  [9]  : I.WindowPtr;
    req [10]  : I.RequesterPtr;
    msg [11]..: SYS.LONGWORD )
  : E.ULONG;
  -90;

LIBCALL (base : DatatypesBasePtr) RemoveDTObject *
  ( win [8] : I.WindowPtr;
    o   [9] : I.ObjectPtr )
  : LONGINT;
  -96;

LIBCALL (base : DatatypesBasePtr) GetDTMethods *
  ( object [8] : I.ObjectPtr )
  : MethodArrayPtr;
  -102;

LIBCALL (base : DatatypesBasePtr) GetDTTriggerMethods *
  ( object [8] : I.ObjectPtr )
  : MethodPtr;
  -108;

LIBCALL (base : DatatypesBasePtr) PrintDTObjectA *
  ( o        [8] : I.ObjectPtr;
    w        [9] : I.WindowPtr;
    r       [10] : I.RequesterPtr;
    VAR msg [11] : I.Msg )
  : E.ULONG;
  -114;

LIBCALL (base : DatatypesBasePtr) PrintDTObject *
  ( o    [8]  : I.ObjectPtr;
    w    [9]  : I.WindowPtr;
    r   [10]  : I.RequesterPtr;
    msg [11]..: SYS.LONGWORD )
  : E.ULONG;
  -114;

LIBCALL (base : DatatypesBasePtr) GetDTString *
  ( id [0] : E.ULONG )
  : E.STRPTR;
  -138;


(*-- Library Base variable --------------------------------------------*)
(* $L- *)

(*-----------------------------------*)
PROCEDURE* CloseLib ();

BEGIN (* CloseLib *)
  IF base # NIL THEN E.base.CloseLibrary (base) END
END CloseLib;

(*-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);

BEGIN (* OpenLib *)
  IF base = NIL THEN
    base :=
      SYS.VAL (
        DatatypesBasePtr,
        E.base.OpenLibrary (name, E.libraryMinimum));
    IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
    ELSIF mustOpen THEN HALT (100)
    END;
  END;
END OpenLib;

BEGIN
  base := NIL
END Datatypes.
