home *** CD-ROM | disk | FTP | other *** search
- #ifndef __INC_POSA_CLIB_IFFPARSE_PROTOS_C
- #define __INC_POSA_CLIB_IFFPARSE_PROTOS_C
- /*******************************************************************
- $CRT 04 Feb 1997 : hp
-
- $AUT Holger Papajewski
- $DAT >>iffparse_protos.c<< 04 Feb 1997 14:15:40 - (C) ProDAD
- *******************************************************************/
-
- #pragma -
-
- #define NOMYDEBUG
-
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
- #ifndef IFF_IFFPARSE_H
- #include <libraries/iffparse.h>
- #endif
-
- #ifndef __INC_POS_PEXEC_MEMORY_H
- #include "p:pExec/Memory.h"
- #endif
- #ifndef __INC_POS_PDOS_IOSTRUCT_H
- #include "p:pDOS/IOStruct.h"
- #endif
- #ifndef __INC_POS_PIFFPARSE_IFFPARSE_H
- #include "p:pIFFParse/IFFParse.h"
- #endif
- #ifndef __INC_POS_PIFFPARSE_IFFPARSETAGS_H
- #include "p:pIFFParse/IFFParseTags.h"
- #endif
- #ifndef __INC_POS_PROTO_PEXEC2_H
- #include "p:proto/pExec2.h"
- #endif
- #ifndef __INC_POS_PROTO_PDOS2_H
- #include "p:proto/pDOS2.h"
- #endif
- #ifndef __INC_POS_PROTO_PIFFPARSE2_H
- #include "p:proto/pIFFParse2.h"
- #endif
-
- #pragma -
-
-
-
- /*\
- *** spezielle IFFHandle Struktur,
- *** um Crosscompiling zu ermöglichen
- \*/
- struct pOS_IFFxA
- {
- ULONG iffhxA_Stream;
- SLONG iffhxA_Depth;
- UWORD iffhxA_IFFMode;
- pOS_IFFHandle *iffhxA_IFF;
- };
-
- enum pOS_IFFxA_IFFMode
- {
- IFFxAMD_IFFasDOS = 0x0001,
- };
-
-
-
-
-
- struct IFFHandle *AllocIFF( void )
- {
- pOS_IFFxA *iffa;
- iffa = (pOS_IFFxA*)pOS_AllocVec(sizeof(pOS_IFFxA),MEMF_CLEAR);
- return((struct IFFHandle*)iffa );
- }
-
-
-
- void FreeIFF( struct IFFHandle *iff )
- { pOS_FreeVec( iff ); }
-
-
-
- void InitIFFasDOS( struct IFFHandle *iff )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
-
- iffa->iffhxA_IFFMode = IFFxAMD_IFFasDOS;
- }
-
-
-
- LONG OpenIFF( struct IFFHandle *iff, long rwMode )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- LONG Res=-1;
-
- if( iffa->iffhxA_Stream )
- {
- switch( iffa->iffhxA_IFFMode )
- {
- case IFFxAMD_IFFasDOS:
- iffa->iffhxA_IFF = pOS_OpenIFF(
- IFFTAG_FH,iffa->iffhxA_Stream,
- IFFTAG_AccessMode, rwMode, TAG_DONE );
- break;
-
- default:
- break;
- }
-
- if( iffa->iffhxA_IFF ) Res=0;
- }
-
- return( Res );
- }
-
-
-
- void CloseIFF( struct IFFHandle *iff )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
-
- if( iffa->iffhxA_IFF )
- {
- switch( iffa->iffhxA_IFFMode )
- {
- case IFFxAMD_IFFasDOS:
- pOS_CloseIFF( iffa->iffhxA_IFF );
- break;
-
- default:
- break;
- }
- iffa->iffhxA_IFF = NULL;
- }
- }
-
-
-
- LONG ParseIFF( struct IFFHandle *iff, long mode )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- SLONG Res=-1;
-
- if( iffa->iffhxA_IFF )
- {
- Res = pOS_ParseIFF( iffa->iffhxA_IFF, mode );
- if( !Res )
- iffa->iffhxA_Depth = iffa->iffhxA_IFF->iffh_Depth;
- }
- return( Res );
- }
-
-
- LONG ReadChunkBytes( struct IFFHandle *iff, APTR buf, long num )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_ReadChunkBytes(iffa->iffhxA_IFF,buf,num));
- }
-
-
-
- LONG WriteChunkBytes( struct IFFHandle *iff, APTR buf, long num )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_WriteChunkBytes(iffa->iffhxA_IFF,buf,num));
- }
-
-
-
- LONG ReadChunkRecords( struct IFFHandle *iff, APTR buf,
- long bytesPerRecord, long numRecords )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- SLONG Res=0;
-
- while( numRecords )
- {
- if(pOS_ReadChunkBytes(iffa->iffhxA_IFF,buf,bytesPerRecord)==bytesPerRecord)
- { buf=(UBYTE*)buf+bytesPerRecord; Res++; numRecords--; }
- else
- { Res=IFFERR_Read; break; }
- }
- return( Res );
- }
-
-
-
- LONG WriteChunkRecords( struct IFFHandle *iff, APTR buf,
- long bytesPerRecord, long numRecords )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- SLONG Res=0;
-
- while( numRecords )
- {
- if(pOS_WriteChunkBytes(iffa->iffhxA_IFF,buf,bytesPerRecord)==bytesPerRecord)
- { buf=(UBYTE*)buf+bytesPerRecord; Res++; numRecords--; }
- else
- { Res=IFFERR_Write; break; }
- }
- return( Res );
- }
-
-
-
- LONG PushChunk( struct IFFHandle *iff, long type, long id, long size )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_PushChunk(iffa->iffhxA_IFF,type,id,size));
- }
-
-
-
- LONG PopChunk( struct IFFHandle *iff )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_PopChunk(iffa->iffhxA_IFF));
- }
-
-
-
- LONG PropChunk( struct IFFHandle *iff, long type, long id )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_PropChunk(iffa->iffhxA_IFF,IFFTAG_ParseType,type,
- IFFTAG_ParseID,id,TAG_DONE));
- }
-
-
-
- LONG PropChunks( struct IFFHandle *iff, LONG *propArray, long numPairs )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- SLONG Res=0;
-
- while( numPairs-- )
- {
- Res=pOS_PropChunk(iffa->iffhxA_IFF,IFFTAG_ParseType,*propArray++,
- IFFTAG_ParseID,*propArray++,TAG_DONE);
-
- if( Res ) break;
- }
- return( Res );
- }
-
-
-
- LONG StopChunk( struct IFFHandle *iff, long type, long id )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_StopChunk(iffa->iffhxA_IFF,IFFTAG_StopType,type,
- IFFTAG_StopID,id,TAG_DONE));
- }
-
-
- LONG StopChunks( struct IFFHandle *iff, LONG *propArray, long numPairs )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- SLONG Res=0;
-
- while( numPairs-- )
- {
- Res=pOS_StopChunk(iffa->iffhxA_IFF,IFFTAG_StopType,*propArray++,
- IFFTAG_StopID,*propArray++,TAG_DONE);
-
- if( Res ) break;
- }
- return( Res );
- }
-
-
-
- LONG StopOnExit( struct IFFHandle *iff, long type, long id )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return(pOS_StopChunk(iffa->iffhxA_IFF,IFFTAG_StopOnExit,TRUE,
- IFFTAG_StopType,type,IFFTAG_StopID,id,TAG_DONE));
- }
-
-
- struct StoredProperty *FindProp( struct IFFHandle *iff, long type, long id )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return((StoredProperty*)pOS_FindProp(iffa->iffhxA_IFF,type,id));
- }
-
-
- struct ContextNode *CurrentChunk( struct IFFHandle *iff )
- {
- pOS_IFFxA *iffa = (pOS_IFFxA*)iff;
- return((ContextNode*)pOS_CurrentChunk(iffa->iffhxA_IFF));
- }
-
- STRPTR IDtoStr( long id, STRPTR buf )
- {
- buf[4] = 0;
- buf[3] = id & 0xFF;
- id >>= 8;
- buf[2] = id & 0xFF;
- id >>= 8;
- buf[1] = id & 0xFF;
- id >>= 8;
- buf[0] = id & 0xFF;
-
- return( buf );
- }
-
-
-
- /*****************************************************************************/
-
-
- #ifdef __IGNORE_NOT_SUPPORTED__
-
-
- LONG EntryHandler( struct IFFHandle *iff, long type, long id, long position,struct Hook *handler, APTR object )
- { return(-1); }
- LONG ExitHandler( struct IFFHandle *iff, long type, long id, long position,struct Hook *handler, APTR object )
- { return(-1); }
- struct CollectionItem *FindCollection( struct IFFHandle *iff, long type,long id )
- { return(NULL); }
- struct ContextNode *FindPropContext( struct IFFHandle *iff )
- { return(NULL); }
- LONG CollectionChunk( struct IFFHandle *iff, long type, long id )
- { return(-1); }
- LONG CollectionChunks( struct IFFHandle *iff, LONG *propArray,long numPairs )
- { return(-1); }
- struct ContextNode *ParentChunk( struct ContextNode *contextNode )
- { return(NULL); }
- struct LocalContextItem *AllocLocalItem( long type, long id, long ident,long dataSize )
- { return(NULL); }
- APTR LocalItemData( struct LocalContextItem *localItem )
- { return(NULL); }
- void SetLocalItemPurge( struct LocalContextItem *localItem,struct Hook *purgeHook )
- {}
- void FreeLocalItem( struct LocalContextItem *localItem )
- {}
- struct LocalContextItem *FindLocalItem( struct IFFHandle *iff, long type,long id, long ident )
- { return(NULL); }
- LONG StoreLocalItem( struct IFFHandle *iff, struct LocalContextItem *localItem,long position )
- { return(-1); }
- void StoreItemInContext( struct IFFHandle *iff,struct LocalContextItem *localItem,struct ContextNode *contextNode )
- {}
- void InitIFF( struct IFFHandle *iff, long flags, struct Hook *streamHook )
- {}
- void InitIFFasClip( struct IFFHandle *iff )
- {}
- struct ClipboardHandle *OpenClipboard( long unitNumber )
- { return(NULL); }
- void CloseClipboard( struct ClipboardHandle *clipHandle )
- {}
- LONG GoodID( long id )
- { return(1); }
- LONG GoodType( long type )
- { return(1); }
-
-
- #endif
-
-
-
- #endif
-