summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Contrib/IFF.def143
-rw-r--r--Contrib/IFFLib.mod230
-rw-r--r--Contrib/README.contrib21
3 files changed, 394 insertions, 0 deletions
diff --git a/Contrib/IFF.def b/Contrib/IFF.def
new file mode 100644
index 0000000..902cf3e
--- /dev/null
+++ b/Contrib/IFF.def
@@ -0,0 +1,143 @@
+(* ---------------------------------------------------------------------------
+
+ IFF.def - Library Interface Module for the iff.library, V18.8, 31-Jul-90
+
+ By Olivier Schraner, Roggenweg 6, 5036 Oberentfelden/AG, Switzerland
+ For A+L's "M2Amiga" Modula-2 Compiler V3.3
+
+--------------------------------------------------------------------------- *)
+
+DEFINITION MODULE IFF {"iff.library",18};
+
+FROM SYSTEM IMPORT ADDRESS,CAST;
+FROM Graphics IMPORT BitMapPtr,ViewModeSet;
+FROM Exec IMPORT MemReqs,MemReqSet;
+
+CONST
+ badTask = -1; (* IFFError() called by wrong task *)
+ cantOpenFile = 16; (* File not found *)
+ readError = 17; (* Error reading file *)
+ noMem = 18; (* Not enough memory *)
+ notIFF = 19; (* File is not an IFF file *)
+ writeError = 20; (* Error writing file *)
+ noILBM = 24; (* IFF file is not of type ILBM *)
+ noBMHD = 25; (* BMHD chunk not found *)
+ noBODY = 26; (* BODY chunk not found *)
+ tooManyPlanes = 27; (* Obsolete since V18.6 *)
+ unknownCompression = 28; (* Unknown compression type *)
+ noANHD = 29; (* ANHD chunk not found *)
+ noDLTA = 30; (* DLTA chunk not found *)
+
+ idFORM = CAST(LONGINT,"FORM") ;
+ idPROP = CAST(LONGINT,"PROP") ;
+ idLIST = CAST(LONGINT,"LIST") ;
+ idCAT = CAST(LONGINT,"CAT ")-ORD(" ") ;
+
+ idANIM = CAST(LONGINT,"ANIM") ;
+ idANHD = CAST(LONGINT,"ANHD") ;
+ idILBM = CAST(LONGINT,"ILBM") ;
+ idBMHD = CAST(LONGINT,"BMHD") ;
+ idBODY = CAST(LONGINT,"BODY") ;
+ idCAMG = CAST(LONGINT,"CAMG") ;
+ idCLUT = CAST(LONGINT,"CLUT") ;
+ idCMAP = CAST(LONGINT,"CMAP") ;
+ idCRNG = CAST(LONGINT,"CRNG") ;
+ idDLTA = CAST(LONGINT,"DLTA") ;
+ idSHAM = CAST(LONGINT,"SHAM") ;
+
+ id8SVX = CAST(LONGINT,"8SVX") ;
+ idATAK = CAST(LONGINT,"ATAK") ;
+ idNAME = CAST(LONGINT,"NAME") ;
+ idRLSE = CAST(LONGINT,"RLSE") ;
+ idVHDR = CAST(LONGINT,"VHDR") ;
+
+
+TYPE
+ UByte=[0..255];
+
+ Chunk=RECORD
+ ckID:LONGINT;
+ ckSize:LONGINT;
+(* ckData:ARRAY [1..ckSize] OF UByte; (variable size) *)
+ END;
+ ChunkPtr=POINTER TO Chunk;
+
+ BitMapHeader=RECORD
+ w:CARDINAL;
+ h:CARDINAL;
+ x:INTEGER;
+ y:INTEGER;
+ nPlanes:UByte;
+ masking:UByte;
+ compression:UByte;
+ pad1:UByte;
+ transparentColor:CARDINAL;
+ xAspect:UByte;
+ yAspect:UByte;
+ pageWidth:INTEGER;
+ pageHeight:INTEGER;
+ END;
+ BitMapHeaderPtr=POINTER TO BitMapHeader;
+
+ AnimHeader=RECORD
+ operation:UByte;
+ mask:UByte;
+ w:CARDINAL;
+ h:CARDINAL;
+ x:INTEGER;
+ y:INTEGER;
+ absTime:LONGCARD;
+ relTime:LONGCARD;
+ interleave:UByte;
+ pad0:UByte;
+ bits:LONGCARD;
+ pad:ARRAY [0..15] OF UByte;
+ END;
+ AnimHeaderPtr=POINTER TO AnimHeader;
+
+ CompressionFlags=(cmpByteRun1,cf1,cf2,cf3,cf4,cf5,cf6,thisIsHAM,cf8,cf9,
+ cf10,cf11,cf12,cf13,cf14,cf15,cf16,cf17,cf18,cf19,cf20,
+ cf21,cf22,cf23,cf24,cf25,cf26,cf27,cf28,cf29,cf30,cf31);
+ CompressionFlagSet=SET OF CompressionFlags;
+
+
+
+PROCEDURE OpenIFF(filename{8}:ADDRESS):ADDRESS; CODE -30;
+
+PROCEDURE CloseIFF(ifffile{9}:ADDRESS); CODE -36;
+
+PROCEDURE FindChunk(ifffile{9}:ADDRESS;
+ chunkname{0}:LONGINT):ADDRESS; CODE -42;
+
+PROCEDURE GetBMHD(ifffile{9}:ADDRESS):BitMapHeaderPtr; CODE -48;
+
+PROCEDURE GetColorTab(ifffile{9}:ADDRESS;
+ colortable{8}:ADDRESS):LONGINT; CODE -54;
+
+PROCEDURE DecodePic(ifffile{9}:ADDRESS;
+ bitmap{8}:BitMapPtr):BOOLEAN; CODE -60;
+
+PROCEDURE SaveBitMap(filename{8}:ADDRESS;
+ bitmap{9}:BitMapPtr;
+ colortable{10}:ADDRESS;
+ flags{0}:CompressionFlagSet):BOOLEAN; CODE -66;
+
+PROCEDURE SaveClip(filename{8}:ADDRESS;
+ bitmap{9}:BitMapPtr;
+ coltab{10}:ADDRESS;
+ flags{0}:CompressionFlagSet;
+ xoff{1}:LONGINT;
+ yoff{2}:LONGINT;
+ width{3}:LONGINT;
+ height{4}:LONGINT):BOOLEAN; CODE -72;
+
+PROCEDURE IFFError():LONGINT; CODE -78;
+
+PROCEDURE GetViewModes(ifffile{9}:ADDRESS):ViewModeSet; CODE -84;
+
+PROCEDURE NewOpenIFF(filename{8}:ADDRESS;type{0}:MemReqSet):ADDRESS; CODE -90;
+
+PROCEDURE ModifyFrame(modForm{9}:ADDRESS;bm{8}:BitMapPtr):BOOLEAN; CODE -96;
+
+
+END IFF.
diff --git a/Contrib/IFFLib.mod b/Contrib/IFFLib.mod
new file mode 100644
index 0000000..eb10d88
--- /dev/null
+++ b/Contrib/IFFLib.mod
@@ -0,0 +1,230 @@
+(*---------------------------------------------------------------------------
+ :Program. IFFLib
+ :Author. Volker Rudolph/Thomas Wagner & Frédéric Pröls
+ :Version. 1.2
+ :Copyright. PD
+ :Language. Oberon
+ :Translator. Amiga-Oberon V2.14
+ :Imports. iff.library - Christian A. Weber
+ :Contents. Oberon library-module for iff.library
+ :Remark. Needs iff.library (Version 22 or higher) in libs: directory
+ :Remark. This ist the Oberon-version of the
+ :Remark. IFFLib-Module for M2Amiga by Fridtjof Siebert
+ :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 André Voget, changed all RECORDs to STRUCTs
+ :bugs. not tested
+---------------------------------------------------------------------------*)
+
+MODULE IFFLib;
+
+IMPORT e := Exec,
+ Graphics,
+ i := Intuition,
+ 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.VAL(LONGINT,"FORM");
+ idLIST * = sys.VAL(LONGINT,"LIST");
+ idCAT * = sys.VAL(LONGINT,"CAT ");
+ idPROP * = sys.VAL(LONGINT,"PROP");
+ idNULL * = sys.VAL(LONGINT," ");
+
+(*
+ * Specific IFF IDs
+*)
+
+ idANIM * = sys.VAL(LONGINT,"ANIM");
+ idANHD * = sys.VAL(LONGINT,"ANHD");
+ idANNO * = sys.VAL(LONGINT,"ANNO");
+ idBMHD * = sys.VAL(LONGINT,"BMHD");
+ idBODY * = sys.VAL(LONGINT,"BODY");
+ idCAMG * = sys.VAL(LONGINT,"CAMG");
+ idCLUT * = sys.VAL(LONGINT,"CLUT");
+ idCMAP * = sys.VAL(LONGINT,"CMAP");
+ idCRNG * = sys.VAL(LONGINT,"CRNG");
+ idCTBL * = sys.VAL(LONGINT,"CTBL");
+ idDLTA * = sys.VAL(LONGINT,"DLTA");
+ idILBM * = sys.VAL(LONGINT,"ILBM");
+ idSHAM * = sys.VAL(LONGINT,"SHAM");
+
+ id8SVX * = sys.VAL(LONGINT,"8SVX");
+ idATAK * = sys.VAL(LONGINT,"ATAK");
+ idNAME * = sys.VAL(LONGINT,"NAME");
+ idRLSE * = sys.VAL(LONGINT,"RLSE");
+ idVHDR * = sys.VAL(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
+ HandlePtr * = UNTRACED POINTER TO Handle;
+ Handle * = STRUCT (* private ! *)
+ file : e.BPTR; (* DOS file handle *)
+ formSize : LONGINT; (* Größe des gesamten FORM *)
+ chunkSize : LONGINT; (* Größe des aktuellen Chunks *)
+ chunkFPos : LONGINT; (* Position im File wo dieser Chunk beginnt *)
+ END;
+
+ ChunkPtr * = UNTRACED POINTER TO Chunk;
+ Chunk * = STRUCT
+ ckID * : LONGINT;
+ ckSize * : LONGINT;
+ ckData * : ARRAY 1048576 OF SHORTINT; (* ARRAY ckSize OF SHORTINT *)
+ END;
+
+ BitMapHeaderPtr * = UNTRACED POINTER TO BitMapHeader;
+ BitMapHeader * = STRUCT
+ w* , h*, x*, y * : INTEGER;
+ nPlanes * : SHORTINT;
+ masking * : SHORTINT;
+ compression * : SHORTINT;
+ pad1 * : SHORTINT;
+ transparentColor * : INTEGER;
+ xAspect * : SHORTINT;
+ yAspect * : SHORTINT;
+ pageWidth * : INTEGER;
+ pageHeight * : INTEGER;
+ END;
+
+ AnimHeaderPtr * = UNTRACED POINTER TO AnimHeader;
+ AnimHeader * = STRUCT
+ operation * : SHORTINT;
+ mask * : SHORTINT;
+ w*,h*,x*,y * : INTEGER;
+ absTime * : LONGINT;
+ relTime * : LONGINT;
+ interLeave * : SHORTINT;
+ pad0 * : SHORTINT;
+ bits * : LONGINT;
+ pad * : ARRAY 16 OF SHORTINT;
+ END;
+
+(*********************** L I B R A R Y - B A S E ************************)
+
+VAR
+ base * : 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 * {base,-30}(fileName{8}: ARRAY OF CHAR): HandlePtr;
+
+PROCEDURE CloseIFF * {base,-36}(iffFile{9}: HandlePtr);
+
+PROCEDURE FindChunk * {base,-42}(iffFile{9}: HandlePtr;
+ hunkName{0}: LONGINT): ChunkPtr;
+
+PROCEDURE GetBMHD * {base,-48}(iffFile{9}: HandlePtr): BitMapHeaderPtr;
+
+PROCEDURE GetColorMap * {base,-54}(iffFile{9}: HandlePtr;
+ colorTable{8}: ARRAY OF INTEGER): LONGINT;
+
+PROCEDURE DecodePic * {base,-60}(iffFile{9}: HandlePtr;
+ bitmap{8}: Graphics.BitMapPtr): BOOLEAN;
+
+PROCEDURE SaveBitMap * {base,-66}(fileName{8}: ARRAY OF CHAR;
+ bitMap{9}: Graphics.BitMapPtr;
+ colorTable{10}: ARRAY OF CHAR;
+ flags{0}: SET): BOOLEAN;
+
+PROCEDURE SaveClip * {base,-72}(fileName{8}: ARRAY OF CHAR;
+ bitmap{9}: Graphics.BitMapPtr;
+ coltab{10}: ARRAY OF CHAR;
+ flags{0}: SET;
+ xoff{1}, yoff{2}: INTEGER;
+ width{3}, height{4}: INTEGER): BOOLEAN;
+
+PROCEDURE IffError * {base,-78}(): LONGINT;
+
+PROCEDURE GetViewModes * {base,-84}(iffFile{9}: HandlePtr): LONGSET;
+
+(* private and obsolete *)
+PROCEDURE OldNewOpenIFF * {base,-90}(name{8}: ARRAY OF CHAR;
+ memattr{0}: LONGSET): e.ADDRESS;
+
+PROCEDURE ModifyFrame * {base,-96}(modifyform{9}: e.APTR;
+ bitmap{8}: Graphics.BitMapPtr);
+
+PROCEDURE OpenIFF * {base, -120}(name{8}: ARRAY OF CHAR;
+ mode{0}: LONGINT): HandlePtr;
+
+PROCEDURE PushChunk * {base, -126}(iff{8}: HandlePtr;
+ type{0}: LONGINT;
+ id{1}: LONGINT);
+
+PROCEDURE PopChunk * {base, -132}(iff{8}: HandlePtr): BOOLEAN;
+
+PROCEDURE WriteChunkBytes * {base, -138}(iff{8}: HandlePtr;
+ buf{9}: ARRAY OF CHAR;
+ size{0}: LONGINT);
+
+PROCEDURE CompressBlock * {base, -144}(source{8}: ARRAY OF sys.BYTE;
+ VAR destination{9}: ARRAY OF sys.BYTE;
+ size{0}: LONGINT;
+ mode{1}: LONGSET);
+
+PROCEDURE DecompressBlock * {base, -150}(source{8}: ARRAY OF sys.BYTE;
+ VAR destination{9}: ARRAY OF sys.BYTE;
+ size{0}: LONGINT;
+ mode{1}: LONGSET);
+
+
+
+(* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
+BEGIN
+
+ base := e.OpenLibrary(iffName,iffVersion);
+
+CLOSE
+
+ IF base # NIL THEN
+ e.CloseLibrary(base)
+ END; (* IF *)
+
+END IFFLib.
+
diff --git a/Contrib/README.contrib b/Contrib/README.contrib
new file mode 100644
index 0000000..c081f65
--- /dev/null
+++ b/Contrib/README.contrib
@@ -0,0 +1,21 @@
+$Id: README.contrib,v 24.1 1994/05/19 15:26:31 chris Exp $
+
+The files in this directory were sent to me by their authors for inclusion
+in the IFF library archive. Please send all comments and questions related
+to these files directly to the authors.
+
+
+IFF.def
+ Modula-2 version of Programmer/IFF.h
+ by Olivier Schraner
+
+
+IFFLib.mod
+ Oberon version of Programmer/IFF.h
+ by Volker Rudolph, Thomas Wagner, Frédéric Pröls, F. Siebert, André Voget
+
+
+Thanks to all contributors!
+
+ -Chris
+