From 36c824864c02f0a3f62c8a1d365d1670835c8c96 Mon Sep 17 00:00:00 2001 From: "Christian A. Weber" Date: Tue, 12 May 1992 22:26:12 +0000 Subject: Initial revision --- Programmer/iff.h | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Programmer/iff.i | 94 +++++++++++++++++++++++++++++++ 2 files changed, 261 insertions(+) create mode 100644 Programmer/iff.h create mode 100644 Programmer/iff.i (limited to 'Programmer') diff --git a/Programmer/iff.h b/Programmer/iff.h new file mode 100644 index 0000000..d62bc05 --- /dev/null +++ b/Programmer/iff.h @@ -0,0 +1,167 @@ +#ifndef LIBRARIES_IFF_H +#define LIBRARIES_IFF_H +/* +** +** $Id: $ +** $Revision: $ +** +** $Filename: iff.h $ +** $Author: Christian A. Weber $ +** $Release: 19.1 $ +** $Date: 90/10/09 22:32:54 $ +** +** Standard header file for programs using iff.library +** +** COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2, +** CH-8037 ZUERICH, SWITZERLAND. +** THIS FILE MAY BE FREELY DISTRIBUTED. USE AT YOUR OWN RISK. +** +*/ + +#ifndef EXEC_TYPES_H +#include +#endif + +#define IFFNAME "iff.library" +#define IFFVERSION 19L /* Current library version */ + +typedef void *IFFFILE; /* The IFF 'FileHandle' structure */ + + +/************** FUNCTION DECLARATIONS ***********************************/ + +#ifdef AZTEC_C +#define __ARGS(a) () /* Remove this for Aztec C V5.x */ +#define NO_PRAGMAS +#else +#define __ARGS(a) a +#endif + +IFFFILE OpenIFF __ARGS((char *)); +void CloseIFF __ARGS((IFFFILE)); +void *FindChunk __ARGS((IFFFILE,LONG)); +struct BitMapHeader *GetBMHD __ARGS((IFFFILE)); +LONG GetColorTab __ARGS((IFFFILE,WORD *)); +BOOL DecodePic __ARGS((IFFFILE,struct BitMap *)); +BOOL SaveBitMap __ARGS((char *,struct BitMap *,WORD *,LONG)); +BOOL SaveClip __ARGS((char *,struct BitMap *,WORD *,LONG,LONG,LONG,LONG,LONG)); +LONG IFFError __ARGS((void)); +ULONG GetViewModes __ARGS((IFFFILE)); /* ULONG since V18.1 */ +APTR NewOpenIFF __ARGS((char *,LONG)); /* Since V16.1 */ +BOOL ModifyFrame __ARGS((void *,struct BitMap *)); /* Since V18.1 */ +IFFFILE PPOpenIFF __ARGS((char *,char *)); + + +/************** ERROR-CODES *********************************************/ + +#define IFF_BADTASK -1 /* IFFError() called by wrong task */ + +#define IFF_CANTOPENFILE 16 /* File not found */ +#define IFF_READERROR 17 /* Error reading file */ +#define IFF_NOMEM 18 /* Not enough memory */ +#define IFF_NOTIFF 19 /* File is not an IFF file */ +#define IFF_WRITEERROR 20 /* Error writing file */ + +#define IFF_NOILBM 24 /* IFF file is not of type ILBM */ +#define IFF_NOBMHD 25 /* BMHD chunk not found */ +#define IFF_NOBODY 26 /* BODY chunk not found */ +#define IFF_TOOMANYPLANES 27 /* Obsolete since V18.6 */ +#define IFF_UNKNOWNCOMPRESSION 28 /* Unknown compression type */ + +#define IFF_NOANHD 29 /* ANHD chunk not found (since V18.1) */ +#define IFF_NODLTA 30 /* DLTA chunk not found (since V18.1) */ + + +/************** COMMON IFF IDs ******************************************/ + +#define MakeID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d)) + +/* List of the most useful IDs, NOT complete, to be continued */ + +#define ID_FORM MakeID('F','O','R','M') +#define ID_PROP MakeID('P','R','O','P') +#define ID_LIST MakeID('L','I','S','T') +#define ID_CAT MakeID('C','A','T',' ') + +#define ID_ANIM MakeID('A','N','I','M') +#define ID_ANHD MakeID('A','N','H','D') +#define ID_BMHD MakeID('B','M','H','D') +#define ID_BODY MakeID('B','O','D','Y') +#define ID_CAMG MakeID('C','A','M','G') +#define ID_CLUT MakeID('C','L','U','T') +#define ID_CMAP MakeID('C','M','A','P') +#define ID_CRNG MakeID('C','R','N','G') +#define ID_CTBL MakeID('C','T','B','L') +#define ID_DLTA MakeID('D','L','T','A') +#define ID_ILBM MakeID('I','L','B','M') +#define ID_SHAM MakeID('S','H','A','M') + +#define ID_8SVX MakeID('8','S','V','X') +#define ID_ATAK MakeID('A','T','A','K') +#define ID_NAME MakeID('N','A','M','E') +#define ID_RLSE MakeID('R','L','S','E') +#define ID_VHDR MakeID('V','H','D','R') + + +/************** STRUCTURES **********************************************/ + +struct Chunk /* Generic IFF chunk structure */ +{ + LONG ckID; + LONG ckSize; +/* UBYTE ckData[ckSize] (variable sized data) */ +}; + +struct BitMapHeader /* BMHD chunk for ILBM files */ +{ + UWORD w,h; + WORD x,y; + UBYTE nPlanes; + UBYTE masking; + UBYTE compression; + UBYTE pad1; + UWORD transparentColor; + UBYTE xAspect,yAspect; + WORD pageWidth,pageHeight; +}; + +struct AnimHeader /* ANHD chunk for ANIM files */ +{ + UBYTE Operation; + UBYTE Mask; + UWORD W; + UWORD H; + WORD X; + WORD Y; + ULONG AbsTime; + ULONG RelTime; + UBYTE Interleave; + UBYTE pad0; + ULONG Bits; + UBYTE pad[16]; +}; + + +/************** PRAGMAS FOR LATTICE C V5.x ******************************/ + +/* Pragmas generated with: 'fd2pragma iff_lib.fd iffpragmas.h' */ + +#ifndef NO_PRAGMAS +extern struct Library *IFFBase; +#pragma libcall IFFBase OpenIFF 1e 801 +#pragma libcall IFFBase CloseIFF 24 901 +#pragma libcall IFFBase FindChunk 2a 0902 +#pragma libcall IFFBase GetBMHD 30 901 +#pragma libcall IFFBase GetColorTab 36 8902 +#pragma libcall IFFBase DecodePic 3c 8902 +#pragma libcall IFFBase SaveBitMap 42 0a9804 +#pragma libcall IFFBase SaveClip 48 43210A9808 +#pragma libcall IFFBase IFFError 4e 0 +#pragma libcall IFFBase GetViewModes 54 901 +#pragma libcall IFFBase NewOpenIFF 5a 0802 +#pragma libcall IFFBase ModifyFrame 60 8902 +#pragma libcall IFFBase PPOpenIFF 66 9802 +#endif + +#endif !LIBRARIES_IFF_H + diff --git a/Programmer/iff.i b/Programmer/iff.i new file mode 100644 index 0000000..4c1bf11 --- /dev/null +++ b/Programmer/iff.i @@ -0,0 +1,94 @@ + IFND LIBRARIES_IFF_I +LIBRARIES_IFF_I SET 1 +** +** $Id: $ +** $Revision: $ +** +** $Filename: iff.i $ +** $Author: Christian A. Weber $ +** $Release: 19.1 $ +** $Date: 90/10/09 22:32:54 $ +** +** Standard header file for programs using iff.library +** +** COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2, +** CH-8037 ZUERICH, SWITZERLAND. +** THIS FILE MAY BE FREELY DISTRIBUTED. USE AT YOUR OWN RISK. +** + + XREF _IFFBase + +IFFVERSION: EQU 19 ; Use this for the OpenLibrary() call + +IFF: MACRO + movea.l _IFFBase,a6 + jsr \1(a6) + ENDM + + +*************** LIBRARY OFFSETS ****************************************** + +_LVOOpenIFF: EQU -30 ; (filename) (A0) +_LVOCloseIFF: EQU -36 ; (ifffile) (A1) +_LVOFindChunk: EQU -42 ; (ifffile,chunkname) (A1,D0) +_LVOGetBMHD: EQU -48 ; (ifffile) (A1) +_LVOGetColorTab: EQU -54 ; (ifffile,colortable) (A1/A0) +_LVODecodePic: EQU -60 ; (ifffile,bitmap) (A1/A0) +_LVOSaveBitMap: EQU -66 ; (name,bmap,ctab,crmd) (A0-A2,D0) +_LVOSaveClip: EQU -72 ; (name,bmap,ctab,crmd,x,y,w,h) (A0-A2,D0-D4) +_LVOIFFError: EQU -78 ; () () +_LVOGetViewModes: EQU -84 ; (ifffile) (A1) +_LVONewOpenIFF: EQU -90 ; (filename,memtype) (A0,D0) +_LVOModifyFrame: EQU -96 ; (modifyform,bitmap) (A1/A0) + + +*************** ERROR CODES ********************************************** + +IFF_BADTASK: EQU -1 ; IffError() called by wrong task + +IFF_CANTOPENFILE: EQU 16 ; File not found +IFF_READERROR: EQU 17 ; Error reading file +IFF_NOMEM: EQU 18 ; Not enough memory +IFF_NOTIFF: EQU 19 ; File is not an IFF file +IFF_WRITEERROR: EQU 20 ; Error writing file + +IFF_NOILBM: EQU 24 ; IFF file is not of type ILBM +IFF_NOBMHD: EQU 25 ; BMHD chunk not found +IFF_NOBODY: EQU 26 ; BODY chunk not found +IFF_TOOMANYPLANES: EQU 27 ; Obsolete since V18.6 +IFF_UNKNOWNCOMPRESSION: EQU 28 ; Unknown compression type + +IFF_NOANHD: EQU 29 ; ANHD chunk not found (since V18.1) +IFF_NODLTA: EQU 30 ; DLTA chunk not found (since V18.1) + + +bmh_Width: EQU 0 ; struct BitMapHeader +bmh_Height: EQU $2 +bmh_XPos: EQU $4 +bmh_YPos: EQU $6 +bmh_nPlanes: EQU $8 +bmh_Masking: EQU $9 +bmh_Compression: EQU $A +bmh_Pad1: EQU $B +bmh_TranspCol: EQU $C +bmh_XAspect: EQU $E +bmh_YAspect: EQU $F +bmh_PageWidth: EQU $10 +bmh_PageHeight: EQU $12 +bmh_SIZEOF: EQU $14 + +anh_Operation: EQU 0 ; struct AnimHeader +anh_Mask: EQU $1 +anh_W: EQU $2 +anh_H: EQU $4 +anh_X: EQU $6 +anh_Y: EQU $8 +anh_AbsTime: EQU $A +anh_RelTime: EQU $E +anh_Interleave: EQU $12 +anh_pad0: EQU $13 +anh_Bits: EQU $14 +anh_pad: EQU $18 +anh_SIZEOF: EQU $28 + + ENDC -- cgit v1.2.3