home *** CD-ROM | disk | FTP | other *** search
- #ifndef __INC_IFFWRITE_C
- #define __INC_IFFWRITE_C
- /*******************************************************************
- $CRT 18 Dec 1996 : hp
-
- $AUT Holger Burkarth
- $DAT >>iffwrite.c<< 29 Jan 1997 13:53:34 - (C) ProDAD
- *******************************************************************/
-
- //##ex mcpp:cppc -gs -o pos:pos/ex/iffwrite p:pLib/StartCode.o p:/pOS_RKRM/pIFFParse/iffwrite.c p:pLib/StdIO.o -l pOSStub -l pOS -l CPPList
-
- /***********************************************************
- pOS programing example - Copyright (C) 1995-97 proDAD
-
- This code was written as an easy to understand example,
- how to program pOS features. It is provided 'as-is',
- without any express or implied warranty.
-
- Permission is hereby granted to use, copy and modify
- this source code for any purpose, without fee, subject
- to the following conditions:
-
- (1) This notice may not be removed or altered from any
- source distribution.
-
- (2) Altered source versions must be plainly marked as
- such, and must not be misrepresented as being
- the original source code.
-
- (3) If only executable code is distributed, then the
- accompanying documentation have to state that
- "this software is based in part on examples of
- the pOS developer packet".
-
- (4) Permission for use of this code is granted only
- if the user accepts full responsibility for any
- undesirable consequences. proDAD accept NO LIABILITY
- for damages of any kind.
-
- ©proDAD
- ***********************************************************/
-
- #include <p:pExec/Types.h>
- #include <p:pExec/Library.h>
- #include <p:pDOS/ArgTags.h>
- #include <p:pDOS/DosArgs.h>
- #include <p:pIFFParse/IFFParse.h>
- #include <p:pIFFParse/IFFParseTags.h>
- #include <p:proto/pExec2.h>
- #include <p:proto/pDOS2.h>
- #include <p:proto/pIFFParse2.h>
-
- #ifdef _____ME_____
- #include "grund/inc_string.h"
- #include "grund/inc_stdio.h"
- #else
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <string.h>
- #include <stdio.h>
- #ifdef __cplusplus
- }
- #endif
- #endif
-
-
- #define ID_ADRS MAKE_ID('A','D','R','S')
- #define ID_NAME MAKE_ID('N','A','M','E')
- #define ID_CITY MAKE_ID('C','I','T','Y')
-
-
- /*\
- *** !!!! Example - No Error Checking !!!!
- \*/
-
- struct pOS_Library *gb_IFFParseBase;
-
-
- const CHAR *HelpText=
- ""
- ;
-
- const CHAR *PrgHeader=
- "Demo for easy writing an IFF file";
-
- const CHAR *PrgVerText=
- "$VER: 1.0 ("__DATE2__") (Copyright 1996-97 by proDAD) (Created by Holger Papajewski)";
-
-
-
- #ifdef __cplusplus
- extern "C"
- #endif
-
- void main()
- {
- SLONG err=0;
- ULONG Ops[1] = {(ULONG)"test.iff"};
- pOS_DosArgs *Args;
-
- Args = pOS_ReadDosArgs( "NAME",Ops,sizeof(Ops)/sizeof(ULONG),
- ARGTAG_PrgHeaderText, (ULONG)PrgHeader, /* kurze Programm-Beschreibung */
- ARGTAG_HelpText, (ULONG)HelpText, /* Help-Texte */
- ARGTAG_PrgVerText, (ULONG)PrgVerText, /* VER-String */
- TAG_DONE);
-
- if(Args) {
- if(gb_IFFParseBase=pOS_OpenLibrary("piffparse.library",0L)) {
-
- pOS_IFFHandle *iff;
-
- iff=pOS_OpenIFF(IFFTAG_DosName,Ops[0],
- IFFTAG_AccessMode,IFFACCMD_Write,TAG_DONE);
-
- if( iff ) {
- pOS_PushChunk(iff,ID_ADRS,ID_CAT,IFF_SizeUnkown);
- pOS_PushChunk(iff,ID_ADRS,ID_FORM,IFF_SizeUnkown);
- pOS_PushChunk(iff,ID_ADRS,ID_NAME,IFF_SizeUnkown);
- pOS_WriteChunkBytes(iff,"Hans ",5);
- pOS_WriteChunkBytes(iff,"Mustermann",11);
- pOS_PopChunk(iff);
-
- pOS_PushChunk(iff,ID_ADRS,ID_CITY,11);
- pOS_WriteChunkBytes(iff,"Mustercity",11);
- pOS_PopChunk(iff);
- pOS_PopChunk(iff);
-
-
- pOS_PushChunk(iff,ID_ADRS,ID_FORM,IFF_SizeUnkown);
- pOS_PushChunk(iff,ID_ADRS,ID_NAME,7);
- pOS_WriteChunkBytes(iff,"proDAD",7);
- pOS_PopChunk(iff);
-
- pOS_PushChunk(iff,ID_ADRS,ID_CITY,IFF_SizeUnkown);
- pOS_WriteChunkBytes(iff,"Immendingen",12);
- pOS_PopChunk(iff);
- pOS_PopChunk(iff);
- pOS_PopChunk(iff);
-
- pOS_CloseIFF(iff);
- }
- else printf("Open IFF File |%s| Failed.\n",Ops[0]);
-
- pOS_CloseLibrary(gb_IFFParseBase);
- }
- else printf("Cannot Open IFFParse.library\n");
-
- pOS_DeleteDosArgs(Args);
- }
- }
-
- #endif
-