home *** CD-ROM | disk | FTP | other *** search
- #include "CompUtils:Expand.cc.h.Universal"
- #include <stdlib.h>
- #include <stdio.h>
-
- #define IBUFF (10*1024)
- #define OBUFF (25*1024)
-
- #define INFILE "RAM:$.infile"
- #define OUTFILE "RAM:$.outfile"
-
- main()
- {
- FILE *in, *out;
-
- /* Set up I/O buffers */
- Expand_SrcBufferPtr = malloc(IBUFF);
- Expand_DestBufferPtr = malloc(OBUFF);
- Expand_SrcLength = IBUFF;
- Expand_DestLength = OBUFF;
-
- /* Set up reason code and output flags */
- Expand_ReasonCode = 0;
- Expand_OutputFlags = OUTPUT_LINEAR; /* All other flags are off */
-
- /* Open source file */
- in = fopen(INFILE, "rb");
- if (in==NULL)
- {
- printf("Can't open input file '%s'\n",INFILE);
- exit(1);
- }
- /* Open destination file */
- out = fopen(OUTFILE, "wb");
- if (out==NULL)
- {
- fclose(in);
- printf("Can't open output file '%s'\n",OUTFILE);
- exit(1);
- }
-
- puts("Starting...\n");
-
- while (Expand() != 0)
- {
- /* A non-zero reason code, so some action must be taken */
- printf("Reason code: %d\n",Expand_ReasonCode);
- switch (Expand_ReasonCode)
- {
- case SRC_EMPTY:
- /* Refill the source buffer */
- fread(Expand_SrcBufferPtr, 1, Expand_SrcLength, in);
- break;
- case DEST_FULL:
- /* Output the destination buffer */
- fwrite(Expand_DestBufferPtr, 1, Expand_BytesWritten, out);
- break;
- case INIT_DONE:
- /* Write the sample period - it's an Armadeus file */
- fwrite(&Expand_SamplePeriod, 1, 1, out);
- printf("File format: Type %d\n",Expand_FileFormat);
- break;
- default:
- fclose(in);
- fclose(out);
- printf("Unexpected reason code (%d)\n",Expand_ReasonCode);
- exit(1);
-
- }
- }
-
- /* Tidy up and exit */
- fclose(in);
- fclose(out);
- }
-