home *** CD-ROM | disk | FTP | other *** search
- #ifndef squash_H
- #define squash_H
-
- /* C header file for Squash
- * written by DefMod (Sep 7 1994) on Wed Sep 14 13:17:59 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef Squash_CompressReturnSizes
- #define Squash_CompressReturnSizes 0x42700
- #undef XSquash_CompressReturnSizes
- #define XSquash_CompressReturnSizes 0x62700
- #undef Squash_Compress
- #define Squash_Compress 0x42700
- #undef XSquash_Compress
- #define XSquash_Compress 0x62700
- #undef Squash_DecompressReturnSizes
- #define Squash_DecompressReturnSizes 0x42701
- #undef XSquash_DecompressReturnSizes
- #define XSquash_DecompressReturnSizes 0x62701
- #undef Squash_Decompress
- #define Squash_Decompress 0x42701
- #undef XSquash_Decompress
- #define XSquash_Decompress 0x62701
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct squash_file squash_file;
-
- /********************
- * Type definitions *
- ********************/
- struct squash_file
- { bits id;
- int size;
- bits load_addr;
- bits exec_addr;
- int reserved;
- byte data [UNKNOWN];
- };
-
- #define squash_FILE(N) \
- struct \
- { bits id; \
- int size; \
- bits load_addr; \
- bits exec_addr; \
- int reserved; \
- byte data [N]; \
- }
-
- #define squash_SIZEOF_FILE(N) \
- (offsetof (squash_file, data) + \
- (N)*sizeof ((squash_file *) NULL)->data)
-
- /************************
- * Constant definitions *
- ************************/
- #define error_SQUASH_BAD_ADDRESS 0x921u
- #define error_SQUASH_BAD_INPUT 0x922u
- #define error_SQUASH_BAD_WORKSPACE 0x923u
- #define error_SQUASH_BAD_PARAMETERS 0x924u
- #define squash_FILE_TYPE 0xFCAu
- #define squash_INPUT_NOT_START 0x1u
- #define squash_INPUT_NOT_END 0x2u
- #define squash_INPUT_ALL_PRESENT 0x4u
- #define squash_OUTPUT_END 0x1u
- #define squash_OUTPUT_MORE 0x2u
- #define squash_OUTPUT_NO_MEM 0x4u
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: squash_compress_return_sizes()
- *
- * Description: Returns the workspace and maximum output sizes for
- * Squash_Compress
- *
- * Input: input_size - value of R1 on entry
- *
- * Output: workspace_size - value of R0 on exit
- * output_size - value of R1 on exit
- *
- * Other notes: Calls SWI 0x42700 with R0 = 0x8.
- */
-
- extern os_error *xsquash_compress_return_sizes (int input_size,
- int *workspace_size,
- int *output_size);
- extern void squash_compress_return_sizes (int input_size,
- int *workspace_size,
- int *output_size);
-
- /* ------------------------------------------------------------------------
- * Function: squash_compress()
- *
- * Description: Provides general compression of a lossless nature
- *
- * Input: input_status - value of R0 on entry
- * workspace - value of R1 on entry
- * input - value of R2 on entry
- * input_size - value of R3 on entry
- * output - value of R4 on entry
- * output_size - value of R5 on entry
- *
- * Output: output_status - value of R0 on exit
- * input_out - value of R2 on exit
- * input_spare - value of R3 on exit
- * output_out - value of R4 on exit
- * output_spare - value of R5 on exit
- *
- * Other notes: Calls SWI 0x42700.
- */
-
- extern os_error *xsquash_compress (bits input_status,
- void *workspace,
- byte *input,
- int input_size,
- byte *output,
- int output_size,
- bits *output_status,
- byte **input_out,
- int *input_spare,
- byte **output_out,
- int *output_spare);
- extern void squash_compress (bits input_status,
- void *workspace,
- byte *input,
- int input_size,
- byte *output,
- int output_size,
- bits *output_status,
- byte **input_out,
- int *input_spare,
- byte **output_out,
- int *output_spare);
-
- /* ------------------------------------------------------------------------
- * Function: squash_decompress_return_sizes()
- *
- * Description: Returns the workspace and maximum output sizes for
- * Squash_Decompress
- *
- * Input: input_size - value of R1 on entry
- *
- * Output: workspace_size - value of R0 on exit
- * output_size - value of R1 on exit
- *
- * Other notes: Calls SWI 0x42701 with R0 = 0x8.
- */
-
- extern os_error *xsquash_decompress_return_sizes (int input_size,
- int *workspace_size,
- int *output_size);
- extern void squash_decompress_return_sizes (int input_size,
- int *workspace_size,
- int *output_size);
-
- /* ------------------------------------------------------------------------
- * Function: squash_decompress()
- *
- * Description: Decompresses data produced by Squash_Compress
- *
- * Input: input_status - value of R0 on entry
- * workspace - value of R1 on entry
- * input - value of R2 on entry
- * input_size - value of R3 on entry
- * output - value of R4 on entry
- * output_size - value of R5 on entry
- *
- * Output: output_status - value of R0 on exit
- * input_out - value of R2 on exit
- * input_spare - value of R3 on exit
- * output_out - value of R4 on exit
- * output_spare - value of R5 on exit
- *
- * Other notes: Calls SWI 0x42701.
- */
-
- extern os_error *xsquash_decompress (bits input_status,
- void *workspace,
- byte *input,
- int input_size,
- byte *output,
- int output_size,
- bits *output_status,
- byte **input_out,
- int *input_spare,
- byte **output_out,
- int *output_spare);
- extern void squash_decompress (bits input_status,
- void *workspace,
- byte *input,
- int input_size,
- byte *output,
- int output_size,
- bits *output_status,
- byte **input_out,
- int *input_spare,
- byte **output_out,
- int *output_spare);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-