DEFINITION MODULE DataTypesD;(*$Implementation:=FALSE*)
(* 31-May-94/bp *)

(* V40 *)

FROM SYSTEM IMPORT
  ADDRESS,BITSET,BPTR,CAST,LONGSET;
FROM DosD IMPORT
  FileInfoBlockPtr;
FROM ExecD IMPORT
  Library,LibraryPtr,List,MinNode,Node,SignalSemaphore;
FROM UtilityD IMPORT
  tagUser,Hook,TagItemPtr;
FROM GraphicsD IMPORT
  ColorMapPtr,Point,PropertyFlagSet,RastPortPtr,Rectangle;
FROM IntuitionD IMPORT
  GadgetInfoPtr,ScreenPtr,WindowPtr;
FROM IFFParseD IMPORT
  IFFHandlePtr;
FROM Printer IMPORT
  PrinterIOPtr;

CONST
  dataTypesName="datatypes.library";

TYPE
  StrPtr=ADDRESS;

(* datatypes.h *)
TYPE
  DataTypesBasePtr=POINTER TO DataTypesBase;
  DataTypesBase=RECORD
    lib:Library;
  END;

CONST
  idDTYP=CAST(LONGCARD,'DTYP');
  idDTHD=CAST(LONGCARD,'DTHD');

TYPE
  DataTypeHeaderPtr=POINTER TO DataTypeHeader;
  DataTypeHeader=RECORD
    name:StrPtr;
    baseName:StrPtr;
    pattern:StrPtr;
    mask:ADDRESS;
    groupId:LONGCARD;
    id:LONGCARD;
    maskLen:INTEGER;
    pad:INTEGER;
    flags:BITSET;
    priority:CARDINAL;
  END;
CONST
  dthSize=SIZE(DataTypeHeader);

  dtfTypeMask=BITSET{0..3};
  dtfBinary  =BITSET{};
  dtfASCII   =BITSET{0};
  dtfIFF     =BITSET{1};
  dtfMisc    =BITSET{0,1};

  dtfCase    =BITSET{4};
  dtfSystem1 =BITSET{12};

  gIdSystem    =CAST(LONGCARD,'syst');
  gIdText      =CAST(LONGCARD,'text');
  gIdDocument  =CAST(LONGCARD,'docu');
  gIdSound     =CAST(LONGCARD,'soun');
  gIdInstrument=CAST(LONGCARD,'inst');
  gIdMusic     =CAST(LONGCARD,'musi');
  gIdPicture   =CAST(LONGCARD,'pict');
  gIdAnimation =CAST(LONGCARD,'anim');
  gIdMovie     =CAST(LONGCARD,'movi');

  idCODE=CAST(LONGCARD,'DTCD');

TYPE
  DTHookContextPtr=POINTER TO DTHookContext;
  DTHookContext=RECORD
    sysBase:LibraryPtr;
    dosBase:LibraryPtr;
    iffParseBase:LibraryPtr;
    utilityBase:LibraryPtr;
    lock:BPTR;
    fib:FileInfoBlockPtr;
    fileHandle:BPTR;
    iff:IFFHandlePtr;
    buffer:StrPtr;
    bufferLength:LONGCARD;
  END;

CONST
  idTOOL=CAST(LONGCARD,'DTTL');

TYPE
  ToolPtr=POINTER TO Tool;
  Tool=RECORD
    which:CARDINAL;
    flags:BITSET;
    program:StrPtr;
  END;

CONST
  tSize=SIZE(Tool);

  (* Tool.which: *)
  twInfo=1;
  twBrowse=2;
  twEdit=3;
  twPrint=4;
  twMail=5;

  (* Tool.flags: *)
  tfLaunchMask=BITSET{0..3};
  tfShell=BITSET{0};
  tfWorkbench=BITSET{1};
  tfRx=BITSET{0,1};


  idTAGS=CAST(LONGCARD,'DTTG');

TYPE
  DataTypePtr=POINTER TO DataType;
  DataType=RECORD
    node1:Node;
    node2:Node;
    header:DataTypeHeaderPtr;
    toolList:List;
    functionName:StrPtr;
    attrList:ADDRESS;
    length:LONGCARD;
  END;

CONST
  dtnSize=SIZE(DataType);

TYPE
  ToolNodePtr=POINTER TO ToolNode;
  ToolNode=RECORD
    node:Node;
    tool:Tool;
    length:LONGCARD;
  END;

CONST
  tnSize=SIZE(ToolNode);

  idNAME=CAST(LONGCARD,'NAME');

  dtErrorUnknownDataType=2000;
  dtErrorCouldntSave=2001;
  dtErrorCouldntOpen=2002;
  dtErrorCouldntSendMessage=2003;
  dtMsgTypeOffset=2100;


(* datatypesclass.h *)
CONST
  dataTypesClass='datatypesclass';

  dtaDummy		=tagUser+1000H;

  dtaTextAttr		=dtaDummy+10;
  dtaTopVert		=dtaDummy+11;
  dtaVisibleVert	=dtaDummy+12;
  dtaTotalVert		=dtaDummy+13;
  dtaVertUnit		=dtaDummy+14;
  dtaTopHoriz		=dtaDummy+15;
  dtaVisibleHoriz	=dtaDummy+16;
  dtaTotalHoriz		=dtaDummy+17;
  dtaHorizUnit		=dtaDummy+18;
  dtaNodeName		=dtaDummy+19;
  dtaTitle		=dtaDummy+20;
  dtaTriggerMethods	=dtaDummy+21;
  dtaData		=dtaDummy+22;
  dtaTextFont		=dtaDummy+23;
  dtaMethods		=dtaDummy+24;
  dtaPrinterStatus	=dtaDummy+25;
  dtaPrinterProc	=dtaDummy+26;
  dtaLayoutProc		=dtaDummy+27;
  dtaBusy		=dtaDummy+28;

  dtaSync		=dtaDummy+29;

  dtaBaseName		=dtaDummy+30;

  dtaGroupID		=dtaDummy+31;

  dtaErrorLevel		=dtaDummy+32;

  dtaErrorNumber	=dtaDummy+33;

  dtaErrorString	=dtaDummy+34;

  dtaConductor		=dtaDummy+35;
  dtaControlPanel	=dtaDummy+36;
  dtaImmediate		=dtaDummy+37;
  dtaRepeat		=dtaDummy+38;

  dtaName		=dtaDummy+100;
  dtaSourceType		=dtaDummy+101;
  dtaHandle		=dtaDummy+102;
  dtaDataType		=dtaDummy+103;
  dtaDomain		=dtaDummy+104;
  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;
  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;

  dtaDestCols		=dtaDummy+400;
  dtaDestRows		=dtaDummy+401;
  dtaSpecial		=dtaDummy+402;

  dtaRastPort		=dtaDummy+403;
  dtaARexxPortName	=dtaDummy+404;

  dtstRam=1;
  dtstFile=2;
  dtstClipBoard=3;
  dtstHotLink=4;

TYPE
  DTSpecialInfoPtr=POINTER TO DTSpecialInfo;
  DTSpecialInfo=RECORD
    lock:SignalSemaphore;
    flags:LONGSET;
    topVert:LONGINT;
    visVert:LONGINT;
    totVert:LONGINT;
    oTopVert:LONGINT;
    vertUnit:LONGINT;
    topHoriz:LONGINT;
    visHoriz:LONGINT;
    totHoriz:LONGINT;
    oTopHoriz:LONGINT;
    horizUnit:LONGINT;
  END;
CONST
  (* Bitnummern für DTSpecialInfo.flags: *)
  dtsiLayout=0;
  dtsiNewSize=1;
  dtsiDragging=2;
  dtsiDragSelect=3;
  dtsiHighlight=4;
  dtsiPrinting=5;
  dtsiLayoutProc=6;

TYPE
  DTMethodPtr=POINTER TO DTMethod;
  DTMethod=RECORD
    label:StrPtr;
    command:StrPtr;
    method:LONGCARD;
  END;

CONST
  dtmDummy		=600H;
  dtmFrameBbox		=601H;
  dtmProcLayout		=602H;
  dtmAsyncLayout	=603H;
  dtmRemoveDTObject	=604H;
  dtmSelect		=605H;
  dtmClearSelected	=606H;
  dtmCopy		=607H;
  dtmPrint		=608H;
  dtmAbortPrint		=609H;
  dtmNewMember		=610H;
  dtmDisposeMember	=611H;
  dtmGoto		=630H;
  dtmTrigger		=631H;
  dtmObtainDrawInfo	=640H;
  dtmDraw		=641H;
  dtmReleaseDrawInfo	=642H;
  dtmWrite		=650H;

TYPE
  FrameInfoPtr=POINTER TO FrameInfo;
  FrameInfo=RECORD
    propertyFlags:PropertyFlagSet;
    resolution:Point;
    redBits:SHORTCARD;
    greenBits:SHORTCARD;
    blueBits:SHORTCARD;
    dimensions:RECORD
      width:LONGCARD;
      height:LONGCARD;
      depth:LONGCARD;
    END;
    screen:ScreenPtr;
    colorMap:ColorMapPtr;
    flags:LONGSET;
  END;
CONST
  (* Bitnummern fuer FrameInfo.flags: *)
  fiScalable	=0;
  fiScrollable	=1;
  fifRemappable	=2;

TYPE
  (* dtmRemoveDTObject, dtmClearSelected, dtmCopy, dtmAbortPrint *)
  dtGeneralPtr=POINTER TO dtGeneral;
  dtGeneral=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
  END;

  (* dtmSelect *)
  dtSelectPtr=POINTER TO dtSelect;
  dtSelect=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    select:Rectangle;
  END;

  (* dtmframeBox *)
  dtFrameBoxPtr=POINTER TO dtFrameBox;
  dtFrameBox=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    contentsInfo:FrameInfoPtr;
    frameInfo:FrameInfoPtr;
    sizeFrameInfo:LONGCARD;
    frameFlags:LONGSET;
  END;
CONST
  frameSpecify=0; (* Bit! *)

TYPE
  (* dtmGoto *)
  dtGotoPtr=POINTER TO dtGoto;
  dtGoto=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    nodeName:StrPtr;
    attrList:ADDRESS;
  END;

  (* dtmTrigger *)
  dtTriggerPtr=POINTER TO dtTrigger;
  dtTrigger=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    function:LONGCARD;
    data:ADDRESS;
  END;
CONST
  stmPause	=1;
  stmPlay	=2;
  stmContents	=3;
  stmIndex	=4;
  stmRetrace	=5;
  stmBrowsePrev	=6;
  stmBrowseNext	=7;
  stmNextField	=8;
  stmPrevField	=9;
  stmActivateField=10;
  stmCommand	=11;

TYPE
  (* dtmPRINT *)
  dtPrintPtr=POINTER TO dtPrint;
  dtPrint=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    pio:PrinterIOPtr;
    attrList:ADDRESS;
  END;

  (* dtmDraw *)
  dtDrawPtr=POINTER TO dtDraw;
  dtDraw=RECORD
    methodID:LONGCARD;
    rPort:RastPortPtr;
    left:LONGINT;
    top:LONGINT;
    width:LONGINT;
    height:LONGINT;
    topHoriz:LONGINT;
    topVert:LONGINT;
    attrList:ADDRESS;
  END;

  (* dtmWrite *)
  dtWritePtr=POINTER TO dtWrite;
  dtWrite=RECORD
    methodID:LONGCARD;
    gInfo:GadgetInfoPtr;
    fileHandle:BPTR;
    mode:LONGCARD;
    attrList:ADDRESS;
  END;
CONST
  dtwmIFF=0;
  dtwmRaw=1;


(* pictureclass.h *)
CONST
  pictureDTClass="picture.datatype";

  pdtaModeID		=dtaDummy+200;
  pdtaBitMapHeader	=dtaDummy+201;
  pdtaBitMap		=dtaDummy+202;
  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;
  pdtaScreen		=dtaDummy+212;
  pdtaFreeSourceBitMap	=dtaDummy+213;
  pdtaGrab		=dtaDummy+214;
  pdtaDestBitMap	=dtaDummy+215;
  pdtaClassBitMap	=dtaDummy+216;
  pdtaNumSparse		=dtaDummy+217;
  pdtaSparseTable	=dtaDummy+218;

  mskNone		=0;
  mskHasMask		=1;
  mskHasTransparentColor=2;
  mskLasso		=3;

  cmpNone		=0;
  cmpByteRun1		=1;

TYPE
  BitMapHeaderPtr=POINTER TO BitMapHeader;
  BitMapHeader=RECORD
    width,
    height:CARDINAL;
    left,
    top:INTEGER;
    depth:SHORTCARD;
    masking:SHORTCARD;
    compression:SHORTCARD;
    pad:SHORTCARD;
    transparent:CARDINAL;
    xAspect,
    yAspect:SHORTCARD;
    pageWidth,
    pageHeight:INTEGER;
  END;

  ColorRegisterPtr=POINTER TO ColorRegister;
  ColorRegister=RECORD
    red,
    green,
    blue:SHORTCARD;
  END;

CONST
  idILBM=CAST(LONGCARD,'ILBM');
  idBMHD=CAST(LONGCARD,'BMHD');
  idBODY=CAST(LONGCARD,'BODY');
  idCMAP=CAST(LONGCARD,'CMAP');
  idCRNG=CAST(LONGCARD,'CRNG');
  idGRAB=CAST(LONGCARD,'GRAB');
  idSPRT=CAST(LONGCARD,'SPRT');
  idDEST=CAST(LONGCARD,'DEST');
  idCAMG=CAST(LONGCARD,'CAMG');


(* soundclass.h *)
CONST
  soundDTClass="sound.datatype";

  sdtaDummy		=dtaDummy+500;
  sdtaVoiceHeader	=sdtaDummy+1;
  sdtaSample		=sdtaDummy+2;
  sdtaSampleLength	=sdtaDummy+3;
  sdtaPeriod		=sdtaDummy+4;
  sdtaVolume		=sdtaDummy+5;
  sdtaCycles		=sdtaDummy+6;

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

TYPE
  VoiceHeaderPtr=POINTER TO VoiceHeader;
  VoiceHeader=RECORD
    oneShotHiSamples:LONGCARD;
    repeatHiSamples:LONGCARD;
    samplesPerHiCycle:LONGCARD;
    samplesPerSec:CARDINAL;
    octaves:SHORTCARD;
    compression:SHORTCARD;
    volume:LONGCARD;
  END;
CONST
  id8SVX=CAST(LONGCARD,'8SVX');
  idVHDR=CAST(LONGCARD,'VHDR');
  (*idBODY=CAST(LONGCARD,'BODY');*)


(* textclass.h *)
CONST
  textDTClass="text.datatype";

  tdtaBuffer	=dtaDummy+300;
  tdtaBufferLen	=dtaDummy+301;
  tdtaLineList	=dtaDummy+302;
  tdtaWordSelect=dtaDummy+303;
  tdtaWordDelim	=dtaDummy+304;

TYPE
  LinePtr=POINTER TO Line;
  Line=RECORD
    link:MinNode;
    text:StrPtr;
    textLen:LONGCARD;
    xOffset:CARDINAL;
    yOffset:CARDINAL;
    width:CARDINAL;
    height:CARDINAL;
    flags:BITSET;
    fgPen:SHORTINT;
    bgPen:SHORTINT;
    style:LONGSET; (* LONG FontStyleSet *)
    data:ADDRESS;
  END;

CONST
  (* Bitnummern fuer Line.flags: *)
  lnLf=0;
  lnLink=1;
  lnObject=2;
  lnSelected=3;

  idFTXT=CAST(LONGCARD,'FTXT');
  idCHRS=CAST(LONGCARD,'CHRS');

END DataTypesD.noimp
