summaryrefslogtreecommitdiff
path: root/Programmer
diff options
context:
space:
mode:
Diffstat (limited to 'Programmer')
-rw-r--r--Programmer/iff.h210
-rw-r--r--Programmer/iff.i200
2 files changed, 267 insertions, 143 deletions
diff --git a/Programmer/iff.h b/Programmer/iff.h
index d62bc05..2725b15 100644
--- a/Programmer/iff.h
+++ b/Programmer/iff.h
@@ -2,13 +2,13 @@
#define LIBRARIES_IFF_H
/*
**
-** $Id: $
-** $Revision: $
+** $Id: iff.h,v 1.1 92/05/12 22:54:06 chris Exp $
+** $Revision: 1.1 $
**
** $Filename: iff.h $
-** $Author: Christian A. Weber $
+** $Author: chris $
** $Release: 19.1 $
-** $Date: 90/10/09 22:32:54 $
+** $Date: 92/05/12 22:54:06 $
**
** Standard header file for programs using iff.library
**
@@ -23,96 +23,121 @@
#endif
#define IFFNAME "iff.library"
-#define IFFVERSION 19L /* Current library version */
+#define IFFVERSION 21L /* Current library version */
-typedef void *IFFFILE; /* The IFF 'FileHandle' structure */
-
-
-/************** FUNCTION DECLARATIONS ***********************************/
+/****************************************************************************
+** Error codes (returned by IFFL_IFFError())
+*/
-#ifdef AZTEC_C
-#define __ARGS(a) () /* Remove this for Aztec C V5.x */
-#define NO_PRAGMAS
-#else
-#define __ARGS(a) a
+#define IFFL_ERROR_BADTASK -1 /* IFFL_IFFError() called by wrong task */
+#define IFFL_ERROR_OPEN 16 /* Can't open file */
+#define IFFL_ERROR_READ 17 /* Error reading file */
+#define IFFL_ERROR_NOMEM 18 /* Not enough memory */
+#define IFFL_ERROR_NOTIFF 19 /* File is not an IFF file */
+#define IFFL_ERROR_WRITE 20 /* Error writing file */
+#define IFFL_ERROR_NOILBM 24 /* IFF file is not of type ILBM */
+#define IFFL_ERROR_NOBMHD 25 /* BMHD chunk not found */
+#define IFFL_ERROR_NOBODY 26 /* BODY chunk not found */
+#define IFFL_ERROR_BADCOMPRESSION 28 /* Unknown compression type */
+#define IFFL_ERROR_NOANHD 29 /* ANHD chunk not found */
+#define IFFL_ERROR_NODLTA 30 /* DLTA chunk not found */
+
+#ifdef IFFLIB_PRE21NAMES
+#define IFF_BADTASK -1
+#define IFF_CANTOPENFILE 16
+#define IFF_READERROR 17
+#define IFF_NOMEM 18
+#define IFF_NOTIFF 19
+#define IFF_WRITEERROR 20
+#define IFF_NOILBM 24
+#define IFF_NOBMHD 25
+#define IFF_NOBODY 26
+#define IFF_TOOMANYPLANES 27
+#define IFF_UNKNOWNCOMPRESSION 28
+#define IFF_NOANHD 29
+#define IFF_NODLTA 30
#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 *********************************************/
+/****************************************************************************
+** Common IFF IDs
+*/
-#define IFF_BADTASK -1 /* IFFError() called by wrong task */
+#define IFFL_MAKE_ID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d))
-#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 */
+/*
+** Generic IFF IDs
+*/
+#ifndef ID_FORM /* don't redefine these if iffparse.h is included */
+#define ID_FORM IFFL_MAKE_ID('F','O','R','M')
+#define ID_CAT IFFL_MAKE_ID('C','A','T',' ')
+#define ID_LIST IFFL_MAKE_ID('L','I','S','T')
+#define ID_PROP IFFL_MAKE_ID('P','R','O','P')
+#endif
-#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 */
+/*
+** Specific IFF IDs
+*/
+#define ID_ANIM IFFL_MAKE_ID('A','N','I','M')
+#define ID_ANHD IFFL_MAKE_ID('A','N','H','D')
+#define ID_BMHD IFFL_MAKE_ID('B','M','H','D')
+#define ID_BODY IFFL_MAKE_ID('B','O','D','Y')
+#define ID_CAMG IFFL_MAKE_ID('C','A','M','G')
+#define ID_CLUT IFFL_MAKE_ID('C','L','U','T')
+#define ID_CMAP IFFL_MAKE_ID('C','M','A','P')
+#define ID_CRNG IFFL_MAKE_ID('C','R','N','G')
+#define ID_CTBL IFFL_MAKE_ID('C','T','B','L')
+#define ID_DLTA IFFL_MAKE_ID('D','L','T','A')
+#define ID_ILBM IFFL_MAKE_ID('I','L','B','M')
+#define ID_SHAM IFFL_MAKE_ID('S','H','A','M')
+
+#define ID_8SVX IFFL_MAKE_ID('8','S','V','X')
+#define ID_ATAK IFFL_MAKE_ID('A','T','A','K')
+#define ID_NAME IFFL_MAKE_ID('N','A','M','E')
+#define ID_RLSE IFFL_MAKE_ID('R','L','S','E')
+#define ID_VHDR IFFL_MAKE_ID('V','H','D','R')
+
+#ifdef IFFLIB_PRE21NAMES
+#define MakeID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d))
+#endif
-#define IFF_NOANHD 29 /* ANHD chunk not found (since V18.1) */
-#define IFF_NODLTA 30 /* DLTA chunk not found (since V18.1) */
+/****************************************************************************
+** Modes for IFFL_OpenIFF()
+*/
-/************** COMMON IFF IDs ******************************************/
+#define IFFL_MODE_READ 0
+#define IFFL_MODE_WRITE 1
-#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 */
+/****************************************************************************
+** Structure definitions
+*/
-#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',' ')
+#ifdef _IFFLIB
-#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')
+typedef struct
+{
+ BPTR File; /* DOS file handle */
+ LONG FormSize; /* Größe des gesamten FORM */
+ LONG ChunkSize; /* Größe des aktuellen Chunks */
+ LONG ChunkFPos; /* Position im File wo dieser Chunk beginnt */
+} *IFFL_HANDLE;
-#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')
+#else
+typedef void *IFFL_HANDLE; /* The IFF 'FileHandle' structure */
-/************** STRUCTURES **********************************************/
+#endif
-struct Chunk /* Generic IFF chunk structure */
+struct IFFL_Chunk /* Generic IFF chunk structure */
{
LONG ckID;
LONG ckSize;
/* UBYTE ckData[ckSize] (variable sized data) */
};
-struct BitMapHeader /* BMHD chunk for ILBM files */
+struct IFFL_BMHD /* BMHD chunk for ILBM files */
{
UWORD w,h;
WORD x,y;
@@ -125,7 +150,7 @@ struct BitMapHeader /* BMHD chunk for ILBM files */
WORD pageWidth,pageHeight;
};
-struct AnimHeader /* ANHD chunk for ANIM files */
+struct IFFL_ANHD /* ANHD chunk for ANIM files */
{
UBYTE Operation;
UBYTE Mask;
@@ -142,9 +167,50 @@ struct AnimHeader /* ANHD chunk for ANIM files */
};
-/************** PRAGMAS FOR LATTICE C V5.x ******************************/
+/****************************************************************************
+** IFF library function prototypes (ANSI)
+*/
+
+void IFFL_CloseIFF ( IFFL_HANDLE );
+BOOL IFFL_DecodePic ( IFFL_HANDLE, struct BitMap * );
+void *IFFL_FindChunk ( IFFL_HANDLE, LONG );
+struct BitMapHeader *IFFL_GetBMHD ( IFFL_HANDLE );
+LONG IFFL_GetColorTab ( IFFL_HANDLE, WORD * );
+ULONG IFFL_GetViewModes ( IFFL_HANDLE );
+LONG IFFL_IFFError ( void );
+BOOL IFFL_ModifyFrame ( void *, struct BitMap * );
+APTR IFFL_NewOpenIFF ( char *, LONG );
+IFFL_HANDLE IFFL_OpenIFF ( char * );
+LONG IFFL_PopChunk ( IFFL_HANDLE );
+IFFL_HANDLE IFFL_PPOpenIFF ( char *, char * );
+LONG IFFL_PushChunk ( IFFL_HANDLE, ULONG, ULONG );
+BOOL IFFL_SaveBitMap ( char *, struct BitMap *, WORD *, LONG );
+BOOL IFFL_SaveClip ( char *, struct BitMap *, WORD *, LONG,
+ LONG, LONG, LONG, LONG );
+LONG IFFL_WriteChunkBytes ( IFFL_HANDLE, void *, LONG );
+
+
+#ifdef IFFLIB_PRE21NAMES
+IFFL_HANDLE OpenIFF(char *);
+void CloseIFF(IFFL_HANDLE);
+void *FindChunk(IFFL_HANDLE,LONG);
+struct BitMapHeader *GetBMHD(IFFL_HANDLE);
+LONG GetColorTab(IFFL_HANDLE,WORD *);
+BOOL DecodePic(IFFL_HANDLE,struct BitMap *);
+BOOL SaveBitMap(char *,struct BitMap *,WORD *,LONG);
+BOOL SaveClip(char *,struct BitMap *,WORD *,LONG,LONG,LONG,LONG,LONG);
+LONG IFFError(void);
+ULONG GetViewModes(IFFL_HANDLE);
+APTR NewOpenIFF(char *,LONG);
+BOOL ModifyFrame(void *,struct BitMap *);
+IFFL_HANDLE PPOpenIFF(char *,char *);
+#endif
+
-/* Pragmas generated with: 'fd2pragma iff_lib.fd iffpragmas.h' */
+/****************************************************************************
+** Pragmas for Lattice C V5.x
+** (generated with: 'fd2pragma iff_lib.fd iffpragmas.h')
+*/
#ifndef NO_PRAGMAS
extern struct Library *IFFBase;
diff --git a/Programmer/iff.i b/Programmer/iff.i
index 4c1bf11..a004d7b 100644
--- a/Programmer/iff.i
+++ b/Programmer/iff.i
@@ -1,13 +1,13 @@
IFND LIBRARIES_IFF_I
LIBRARIES_IFF_I SET 1
**
-** $Id: $
-** $Revision: $
+** $Id: iff.i,v 1.1 92/05/12 22:54:18 chris Exp $
+** $Revision: 1.1 $
**
** $Filename: iff.i $
-** $Author: Christian A. Weber $
+** $Author: chris $
** $Release: 19.1 $
-** $Date: 90/10/09 22:32:54 $
+** $Date: 92/05/12 22:54:18 $
**
** Standard header file for programs using iff.library
**
@@ -18,77 +18,135 @@ LIBRARIES_IFF_I SET 1
XREF _IFFBase
-IFFVERSION: EQU 19 ; Use this for the OpenLibrary() call
+IFFNAME MACRO
+ dc.b 'iff.library',0
+ ENDM
+
+IFFVERSION: EQU 21 ; Current library version
+
+
+*****************************************************************************
+** Error codes (returned by IFFL_IFFError())
+
+IFFL_ERROR_BADTASK EQU -1 ; IFFL_IFFError() called by wrong task
+IFFL_ERROR_OPEN EQU 16 ; Can't open file
+IFFL_ERROR_READ EQU 17 ; Error reading file
+IFFL_ERROR_NOMEM EQU 18 ; Not enough memory
+IFFL_ERROR_NOTIFF EQU 19 ; File is not an IFF file
+IFFL_ERROR_WRITE EQU 20 ; Error writing file
+IFFL_ERROR_NOILBM EQU 24 ; IFF file is not of type ILBM
+IFFL_ERROR_NOBMHD EQU 25 ; BMHD chunk not found
+IFFL_ERROR_NOBODY EQU 26 ; BODY chunk not found
+IFFL_ERROR_BADCOMPRESSION EQU 28 ; Unknown compression type
+IFFL_ERROR_NOANHD EQU 29 ; ANHD chunk not found
+IFFL_ERROR_NODLTA EQU 30 ; DLTA chunk not found
+
+ IFD IFFLIB_PRE21NAMES
+IFF_BADTASK EQU -1
+IFF_CANTOPENFILE EQU 16
+IFF_READERROR EQU 17
+IFF_NOMEM EQU 18
+IFF_NOTIFF EQU 19
+IFF_WRITEERROR EQU 20
+IFF_NOILBM EQU 24
+IFF_NOBMHD EQU 25
+IFF_NOBODY EQU 26
+IFF_TOOMANYPLANES EQU 27
+IFF_UNKNOWNCOMPRESSION EQU 28
+IFF_NOANHD EQU 29
+IFF_NODLTA EQU 30
+ ENDC
+
+
+*****************************************************************************
+** Common IFF IDs
+
+** Generic IFF IDs
+
+ IFND ID_FORM ; don't redefine if iffparse.i is included
+ID_FORM EQU 'FORM'
+ID_CAT EQU 'CAT '
+ID_LIST EQU 'LIST'
+ID_PROP EQU 'PROP'
+ ENDC
-IFF: MACRO
- movea.l _IFFBase,a6
- jsr \1(a6)
- ENDM
+** Specific IFF IDs
+
+ID_ANIM EQU 'ANIM'
+ID_ANHD EQU 'ANHD'
+ID_BMHD EQU 'BMHD'
+ID_BODY EQU 'BODY'
+ID_CAMG EQU 'CAMG'
+ID_CLUT EQU 'CLUT'
+ID_CMAP EQU 'CMAP'
+ID_CRNG EQU 'CRNG'
+ID_CTBL EQU 'CTBL'
+ID_DLTA EQU 'DLTA'
+ID_ILBM EQU 'ILBM'
+ID_SHAM EQU 'SHAM'
+
+ID_8SVX EQU '8SVX'
+ID_ATAK EQU 'ATAK'
+ID_NAME EQU 'NAME'
+ID_RLSE EQU 'RLSE'
+ID_VHDR EQU 'VHDR'
*************** 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
+ IFD IFFLIB_PRE21NAMES
+_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)
+ ENDC
+
+
+*****************************************************************************
+** Modes for IFFL_OpenIFF()
+
+IFFL_MODE_READ EQU 0
+IFFL_MODE_WRITE EQU 1
+
+
+*****************************************************************************
+** Structure definitions
+
+bmh_Width EQU 0 ; BMHD: 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 ; ANHD: 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