home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
pd
/
graphics
/
viewers
/
mugiff
/
txt
/
ifflib.def
next >
Wrap
Text File
|
1993-02-19
|
9KB
|
247 lines
(*---------------------------------------------------------------------------
:Program. IFFLib
:Author. Volker Rudolph/Thomas Wagner & Frédéric Pröls
:Version. 1.3
:Copyright. PD
:Language. Modula-2
:Translator. M2Amiga 4.1
:Imports. iff.library - Christian A. Weber
:Contents. Modula-2 library-module for iff.library
:Remark. Needs iff.library (Version 22 or higher) in libs: directory
:Remark. This ist the Modula-2 version of the C include file
:History. V1.0 by Volker Rudolph
:History. V1.1 by Thomas Wagner & Frédéric Pröls
:History. Update to iff.library version 22 (29-Jul-92)
:History. V1.2 by F. Siebert small chgs. for Amiga Oberon 3.0
:History. V1.3 by Mark Rose rewrite from C-version for M2Amiga 4.1
---------------------------------------------------------------------------*)
(*$ LargeVars := FALSE LongAlign := FALSE *)
(*$ Volatile := FALSE StackParms := FALSE NameChk := FALSE *)
DEFINITION MODULE IFFLib{"iff.library",22};
IMPORT DosD;
IMPORT e : ExecD;
IMPORT GraphicsD;
IMPORT i : IntuitionD;
IMPORT sys : SYSTEM;
CONST
IffName = "iff.library";
IffVersion = 22; (* Current library version *)
(************** E R R O R - C O D E S ***********************************)
errorBadTask = -1; (* IffError() called by wrong task *)
errorOpen = 16; (* Can't open file *)
errorRead = 17; (* Error reading file *)
errorNoMem = 18; (* Not enough memory *)
errorNotIff = 19; (* File is not an IFF file *)
errorWrite = 20; (* Error writing file *)
errorNoILBM = 24; (* IFF file is not of type ILBM *)
errorNoBMHD = 25; (* BMHD chunk not found *)
errorNoBODY = 26; (* BODY chunk not found *)
errorBadCompression = 28; (* Unknown compression type *)
errorNoANHD = 29; (* ANHD chunk not found *)
errorNoDLTA = 30; (* DLTA chunk not found *)
(************** Common IFF IDs ******************************************)
(*
* Universal IFF identifiers.
*)
idFORM = sys.CAST (LONGINT,"FORM");
idLIST = sys.CAST (LONGINT,"LIST");
idCAT = sys.CAST (LONGINT,"CAT ");
idPROP = sys.CAST (LONGINT,"PROP");
idNULL = sys.CAST (LONGINT," ");
(*
* Specific IFF IDs
*)
idANIM = sys.CAST (LONGINT,"ANIM");
idANHD = sys.CAST (LONGINT,"ANHD");
idANNO = sys.CAST (LONGINT,"ANNO");
idBMHD = sys.CAST (LONGINT,"BMHD");
idBODY = sys.CAST (LONGINT,"BODY");
idCAMG = sys.CAST (LONGINT,"CAMG");
idCLUT = sys.CAST (LONGINT,"CLUT");
idCMAP = sys.CAST (LONGINT,"CMAP");
idCRNG = sys.CAST (LONGINT,"CRNG");
idCTBL = sys.CAST (LONGINT,"CTBL");
idDLTA = sys.CAST (LONGINT,"DLTA");
idILBM = sys.CAST (LONGINT,"ILBM");
idSHAM = sys.CAST (LONGINT,"SHAM");
id8SVX = sys.CAST (LONGINT,"8SVX");
idATAK = sys.CAST (LONGINT,"ATAK");
idNAME = sys.CAST (LONGINT,"NAME");
idRLSE = sys.CAST (LONGINT,"RLSE");
idVHDR = sys.CAST (LONGINT,"VHDR");
(****************************************************************************
* Modes for OpenIFF()
*)
modeRead = 0;
modeWrite = 1;
(****************************************************************************
* Modes for CompressBlock() and DecompressBlock()
*)
comprNone = 0000H; (* generic *)
comprByteRun1 = 0001H; (* ILBM *)
comprFibDelta = 0101H; (* 8SVX *)
(************** S T R U C T U R E S *************************************)
TYPE
APTR = POINTER TO sys.ADDRESS;
HandlePtr = POINTER TO Handle;
Handle = RECORD (* private ! *)
file : DosD.FileHandlePtr; (* DOS file handle *)
formSize : LONGINT; (* Size of the whole FORM *)
chunkId : LONGINT; (* Id of current chunk *)
(*
** ^- This was defined as chunkSize. But Christian Weber used it in his
** own code as identification of the chunk. It is undocumented but
** used in this way by the author himself therefore it should be legal.
*)
chunkFPos : LONGINT; (* Pos. in file where this chunk starts *)
END;
ChunkPtr = POINTER TO Chunk;
Chunk = RECORD
ckID : LONGINT;
ckSize : LONGINT;
(* ckData : ARRAY [1 .. ckSize] OF SHORTCARD; *)
END;
BitMapHeaderPtr = POINTER TO BitMapHeader;
BitMapHeader = RECORD
w, h : CARDINAL;
x, y : INTEGER;
nPlanes,
masking,
compression,
pad1 : SHORTCARD;
transparentColor : CARDINAL;
xAspect, yAspect : SHORTCARD;
pageWidth,
pageHeight : INTEGER;
END;
AnimHeaderPtr = POINTER TO AnimHeader;
AnimHeader = RECORD
operation,
mask : SHORTCARD;
w, h : CARDINAL;
x, y : INTEGER;
absTime,
relTime : LONGCARD;
interLeave,
pad0 : SHORTCARD;
bits : LONGCARD;
pad : ARRAY [0 .. 15] OF SHORTCARD;
END;
(*********************** L I B R A R Y - B A S E ************************)
VAR
iffVersion : INTEGER;
iffBase : e.LibraryPtr;
(************** F U N C T I O N D E C L A R A T I O N S ***************)
(* obsolete *)
PROCEDURE OldOpenIFF (fileName{8} : sys.ADDRESS)
: HandlePtr; CODE -30;
PROCEDURE CloseIFF (iffFile{9} : HandlePtr);
CODE -36;
PROCEDURE FindChunk (iffFile{9} : HandlePtr;
hunkName{0} : LONGINT)
: ChunkPtr; CODE -42;
PROCEDURE GetBMHD (iffFile{9} : HandlePtr)
: BitMapHeaderPtr; CODE -48;
PROCEDURE GetColorTab (iffFile{9} : HandlePtr;
colorTable{8} : sys.ADDRESS)
: LONGINT; CODE -54;
PROCEDURE DecodePic (iffFile{9} : HandlePtr;
bitmap{8} : GraphicsD.BitMapPtr)
: BOOLEAN; CODE -60;
PROCEDURE SaveBitMap (fileName{8} : sys.ADDRESS;
bitMap{9} : GraphicsD.BitMapPtr;
colorTable{10} : sys.ADDRESS;
flags{0} : LONGINT)
: BOOLEAN; CODE -66;
PROCEDURE SaveClip (fileName{8} : sys.ADDRESS;
bitmap{9} : GraphicsD.BitMapPtr;
coltab{10} : sys.ADDRESS;
flags{0} : LONGINT;
xoff{1}, yoff{2} : LONGINT;
width{3}, height{4}: LONGINT)
: BOOLEAN; CODE -72;
PROCEDURE IffError ( ) : LONGINT; CODE -78;
PROCEDURE GetViewModes (iffFile{9} : HandlePtr)
: GraphicsD.ViewModeSet; CODE -84;
(* private and obsolete *)
PROCEDURE OldNewOpenIFF (name{8} : sys.ADDRESS;
memattr{0} : LONGINT)
: sys.ADDRESS; CODE -90;
PROCEDURE ModifyFrame (modifyform{9} : HandlePtr;
bitmap{8} : GraphicsD.BitMapPtr)
: BOOLEAN; CODE -96;
PROCEDURE OpenIFF (name{8} : sys.ADDRESS;
mode{0} : LONGCARD)
: HandlePtr; CODE -120;
PROCEDURE PushChunk (iff{8} : HandlePtr;
type{0} : LONGCARD;
id{1} : LONGCARD)
: BOOLEAN; CODE -126;
PROCEDURE PopChunk (iff{8} : HandlePtr)
: BOOLEAN; CODE -132;
PROCEDURE WriteChunkBytes (iff{8} : HandlePtr;
buf{9} : sys.ADDRESS;
size{0} : LONGINT)
: BOOLEAN; CODE -138;
PROCEDURE CompressBlock (source{8} : sys.ADDRESS;
VAR destination{9} : sys.ADDRESS;
size{0} : LONGCARD;
mode{1} : LONGCARD)
: LONGCARD; CODE -144;
PROCEDURE DecompressBlock (source{8} : sys.ADDRESS;
VAR destination{9} : sys.ADDRESS;
size{0} : LONGCARD;
mode{1} : LONGCARD)
: LONGCARD; CODE -150;
END IFFLib.