home *** CD-ROM | disk | FTP | other *** search
- /* Note - this is designed for Easy C, so changes changes may be needed */
- #include <roslib.h>
-
- #include "CompUtils:ExpCode.cc.h.Universal"
- #include <stdlib.h>
- #include <stdio.h>
-
-
- #define INFILE "RAM:$.Infile"
- #define OUTFILE "RAM:$.Outfile"
-
- #define IBUFF (10*1024)
-
- main()
- {
- os_error *errorptr;
- char filename[] = INFILE;
- os_filestr fs; /* Easy C only? */
-
- /* Claim the source buffer */
- ExpCode_SrcBufferPtr = malloc(IBUFF);
- ExpCode_SrcLength = IBUFF;
-
- /* Set up filename pointer */
- ExpCode_FilenamePtr = filename;
-
- /* Set up output flags for 8-bit linear, not enhanced */
- ExpCode_OutputFlags = 0x00;
-
- /* Finally, set up offset into file */
- ExpCode_DataOffset = 0;
-
- /* Call initialisation routine and display any errors */
- errorptr = ExpCode_Init();
- if (errorptr)
- {
- printf("Error: %s\n", errorptr->errmess);
- exit(1);
- }
-
- /* Claim destination buffer */
- ExpCode_DestBufferPtr = malloc(ExpCode_SampleLength);
- ExpCode_DestLength = ExpCode_SampleLength;
-
- /* Process the sample */
- errorptr = ExpCode_Process();
- if (errorptr)
- {
- printf("Error: %s\n", errorptr->errmess);
- exit(1);
- }
-
- /* Save output to file - may be Easy C specific */
- fs.action = 10;
- fs.objname = OUTFILE;
- fs.loadaddr = 0xffd; /* filetype = Data */
- fs.startaddr = (int)ExpCode_DestBufferPtr;
- fs.endaddr = fs.startaddr + ExpCode_SampleLength;
- errorptr = os_file(&fs);
- if (errorptr)
- {
- printf("Error: %s\n", errorptr->errmess);
- exit(1);
- }
-
- /* All done - no need to free the buffers in this case */
- }
-