Sage-ST ä

Compress

Documentation

Global Declarations (Constants, Types, Variables)
CompressBuf CompressBuffer CompressFile
STRCompressFile STRUnCompressFile UnCompress UnCompressBuffer
UnCompressFile





  type
    LoadBuffer = procedure
    (const buf   : pointer;
     var   TotIn : cardinal); stdcall;

    PutBuffer = procedure
    (const buf     : pointer;
     const TotOut  : cardinal;
     var   Success : boolean); stdcall;




  procedure CompressBuf
             (const compression  : cardinal;
              const workBuffer   : pointer;
              const workLength   : cardinal;
              const inputProc    : LoadBuffer;
              const outputProc   : PutBuffer;
              const showProgress : boolean;
              var   Status       : cardinal); stdcall;

  exports CompressBuf name 'Compress_CompressBuf';

  //*
  //  CompressBuf - Compress data from and to buffers.
  //
  //
  //  This procedure  begins the process  of compressing data.  The data
  //  compression method  used is a sliding  dictionary method to reduce
  //  repeated  byte sequences.  The size  of the  dictionary depends on
  //  compression factor. Valid compression factors are :
  //
  //    1  -   512 byte buffer, minimum compression, least time
  //    2  -  1024 byte buffer, better compression, more time
  //    3  -  2048 byte buffer, better compression, more time
  //    4  -  4096 byte buffer, best compression, longest time
  //
  //  Compression factors outside this range will default to a factor of
  //  2.
  //
  //  'inputProc'  will  be  called  by  the  program  when more data is
  //  needed. The  user is required to  fill in the 'Buffer'  to the the
  //  'totalIn' value  received from compress and  pass the total number
  //  of  bytes loaded  back in  'totalIn'.  A  value of  zero will  end
  //  compress processing signaling the end of data.
  //
  //  'outputProc' will be  called when there is no  room to output more
  //  data or at the conclusion of the program. 'totalOut', the number of
  //  bytes in the output buffer, is  passed to you. Process this buffer
  //  as needed. When control is  passed back to the compression program
  //  data will again be written to the buffer from the first. 'success'
  //  set to False will indicate an error and processing will quit.
  //
  //  CALLING SEQUENCE -
  //
  //    CompressBuf (compression, workBuffer, workLength,
  //                 inputProc, outputProc,
  //                 showProgress, status);
  //
  //  ENTRY -
  //
  //    compression : cardinal
  //      Compression factor (1 .. 4).
  //
  //    workBuffer : pointer
  //      Address  of a  working buffer.   Must be  at least  four times
  //      bigger  than   the  search  buffer   size  indicated  by   the
  //      compression factor.
  //
  //    workLength : cardinal
  //      Total length of workbuffer in bytes.
  //
  //    inputProc : LoadBuffer
  //      procedure to load buffer when needed;
  //
  //    outputProc : PutBuffer
  //      procedure to put buffer when needed;
  //
  //    showProgress : boolean
  //      Show  a  device  (propeller)  which  indicates  compression in
  //      progress.
  //
  //  EXIT -
  //
  //    status : cardinal
  //      Number indicating the status of the compression result.
  //        0 - No error occurred
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //
  //  EXAMPLE -
  //
  //    procedure LoadInput
  //               (    buffer : pointer;
  //                var totalIn : cardinal);
  //    begin
  //      ReadData (buffer, totalIn);
  //    end;  // LoadInput
  //
  //    procedure PutOutputBuffer
  //         (    buffer : pointer;
  //              totalOut : cardinal;
  //          var success : boolean);
  //
  //    begin
  //      success := WriteData (buffer, totalOut);
  //    end;  // PutOutput
  //
  //
  //    procedure MyProgram;
  //
  //    begin
  //       .
  //       .
  //      Compress.Compress (compression, SYSTEM.ADR (workBuffer), workLength,
  //                        LoadInput, PutOutputBuffer,
  //                        showProgress, status);
  //       .
  //       .
  //    end;  // MyProgram
  //




  procedure UnCompress
             (const workBuffer   : pointer;
              const workLength   : cardinal;
              const inputProc    : LoadBuffer;
              const outputProc   : PutBuffer;
              const showProgress : boolean;
              var   Status       : cardinal); stdcall;

  exports UnCompress name 'Compress_UnCompress';

  //*
  //  UnCompress - Uncompress data from and to buffers.
  //
  //
  //  This procedure reverses the process  of compressing data. The data
  //  must have been compressed using this compression package.
  //
  //  'inputProc'  will  be  called  by  the  program  when more data is
  //  needed. The user  is required to fill in the  buffer up to the the
  //  'totalIn' value  received from compress and  pass the total number
  //  of  bytes loaded  back in  'totalIn'.  A  value of  zero will  end
  //  compress processing signaling the end of data.
  //
  //  'outputProc' will be  called when there is no  room to output more
  //  data or  at the conclusion  of the program.  'totalOut', the total
  //  number of  bytes in the output  buffer, is passed to  you. Process
  //  this  buffer  as  needed.  When  control  is  passed  back  to the
  //  compression program data will again  be written to the buffer from
  //  the  first. 'success'  set to   False will  indicate an  error and
  //  processing will quit.
  //
  //  CALLING SEQUENCE -
  //
  //    Compress.UnCompress (workBuffer, workLength,
  //                         inputProc, outputProc,
  //                         showProgress, status);
  //
  //  ENTRY -
  //
  //    workBuffer : pointer
  //      Address  of a  working buffer.   Must be  at least  four times
  //      bigger  than   the  search  buffer   size  indicated  by   the
  //      compression factor used to compress the data.
  //
  //    workLength : cardinal
  //      Total length of workbuffer in bytes.
  //
  //    inputProc : LoadBuffer
  //      procedure to load buffer when needed;
  //
  //    outputProc : PutBuffer
  //      procedure to put buffer when needed;
  //
  //    showProgress : boolean
  //      Show  a  device  (propeller)  which  indicates  compression in
  //      progress.
  //
  //  EXIT -
  //
  //    status : cardinal
  //      Number indicating the status of the uncompression result.
  //        0 - No error occurred
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //
  //  EXAMPLE -
  //
  //    procedure LoadInput
  //               (    buffer : pointer;
  //                var totalIn : cardinal);
  //    begin
  //      ReadData (buffer, totalIn);
  //    end;  // LoadInput
  //
  //    procedure PutOutputBuffer
  //               (    buffer : pointer;
  //                    totalOut : cardinal;
  //                    success : boolean);
  //
  //    begin
  //      success := WriteData (buffer, totalOut);
  //    end;  // PutOutput
  //
  //    procedure MyProgram;
  //
  //    begin
  //      .
  //      .
  //      Compress.UnCompress (workBuffer'address, workLength,
  //                          LoadInput, PutOutputBuffer,
  //                          showProgress, status);
  //      .
  //      .
  //    end MyProgram;
  //




  procedure CompressBuffer
             (const compression  : cardinal;
              const inBuffer     : pointer;
              const inBufLength  : cardinal;
              const outBuffer    : pointer;
              const outBufLength : cardinal;
              const showProgress : boolean;
              var   resultLength : cardinal;
              var   Status       : cardinal); stdcall;

  exports CompressBuffer name 'Compress_CompressBuffer';

  //*
  //  CompressBuffer - Compress a memory buffer.
  //
  //
  //  This routine will use the  Compress procedure to compress an input
  //  buffer and write the compressed data to an output buffer.
  //
  //  The size  of the dictionary  depends on compression  factor. Valid
  //  compression factors are :
  //
  //    1  -   512 byte buffer, minimum compression, least time
  //    2  -  1024 byte buffer, better compression, more time
  //    3  -  2048 byte buffer, better compression, more time
  //    4  -  4096 byte buffer, best compression, longest time
  //
  //  Compression factors outside this range will default to a factor of
  //  2.
  //
  //  CALLING SEQUENCE -
  //
  //    CompressBuffer (compression,
  //                    inBuffer, inBufLength,
  //                    outBuffer, outBufLength,
  //                    showProgress,
  //                    resultLength, status);
  //
  //  ENTRY -
  //
  //    compression : cardinal
  //      Compression factor (1 .. 4).
  //
  //    inBuffer : pointer
  //      Address  of  the  buffer  containing  the  input  data  to  be
  //      compressed.
  //
  //    inBufLength : cardinal
  //      Length of the input buffer;
  //
  //    outBuffer : pointer
  //      Address of the buffer where compressed input buffer data is
  //      to be stored.
  //
  //    outBufLength : cardinal
  //      Length of the output buffer;
  //
  //    showProgress : boolean
  //      Show a device (propeller) which indicates compression in
  //      progress.
  //
  //    resultLength : cardinal
  //      The valid length of the resluting compressed data stored in
  //      the output buffer.
  //
  //  EXIT -
  //
  //    status : cardinal
  //      Number indicating the status of the compression result.
  //        0 - No error occurred
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //




  procedure UnCompressBuffer
             (const inBuffer     : pointer;
              const inBufLength  : cardinal;
              const outBuffer    : pointer;
              const outBufLength : cardinal;
              const showProgress : boolean;
              var   resultLength : cardinal;
              var   Status       : cardinal); stdcall;

  exports UnCompressBuffer name 'Compress_UnCompressBuffer';

  //*
  //  UnCompressBuffer - Uncompress a memory buffer.
  //
  //
  //  This routine  will use the  Uncompress procedure to  uncompress an
  //  input buffer and write the uncompressed data to an output buffer.
  //
  //  This procedure reverses the process  of compressing data. The data
  //  must have been compressed using this compression package.
  //
  //  CALLING SEQUENCE -
  //
  //    UnCompressBuffer (inBuffer, inBufLength,
  //                      outBuffer, outBufLength,
  //                      showProgress,
  //                      resultLength, status);
  //
  //  ENTRY -
  //
  //    inBuffer : pointer
  //      Address  of  the  buffer  containing  the  input  data  to  be
  //      uncompressed.
  //
  //    inBufLength : cardinal
  //      Length of the input buffer.
  //
  //    outBuffer : pointer
  //      Address of the buffer where uncompressed input buffer data is
  //      to be stored.
  //
  //    outBufLength : cardinal
  //      Length of the output buffer.
  //
  //    showProgress : boolean
  //      Show a device (propeller) which indicates compression in
  //      progress.
  //
  //  EXIT -
  //
  //    resultLength : cardinal
  //      The valid length of the resluting compressed data stored in
  //      the output buffer.
  //
  //    status : cardinal
  //      Number indicating the status of the uncompression result.
  //        0 - No error occurred
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //




  procedure CompressFile
             (const fileIn       : array of char;
              const fileOut      : array of char;
              const compression  : cardinal;
              const showProgress : boolean;
              var   bytesIn      : ModSys.INT32;
              var   bytesOut     : ModSys.INT32;
              var   Status       : cardinal); overload; stdcall;

  exports CompressFile (const fileIn       : array of char;
                        const fileOut      : array of char;
                        const compression  : cardinal;
                        const showProgress : boolean;
                        var   bytesIn      : ModSys.INT32;
                        var   bytesOut     : ModSys.INT32;
                        var   Status       : cardinal) name 'Compress_CompressFile';

  //*
  //  CompressFile - Compress a DOS file to another file.
  //
  //
  //  This routine will use the Compress procedure, read the input file,
  //  compress the data and write the compressed data to another file.
  //
  //  CALLING SEQUENCE -
  //
  //    CompressFile (fileIn, fileOut, compression,
  //                  bytesIn, bytesOut, status);
  //
  //  ENTRY -
  //
  //    fileIn : array of char
  //      File  name of  file to  be compressed.  Must include  any path
  //      information if needed.
  //
  //    fileOut : array of char
  //      File  name  of  the  comressed  file.  Must  include  any path
  //      information if needed. The compressed  file cannot be the same
  //      as  the input  file name.  The file  is tagged  with a special
  //      sequence  of characters  to indicate  that it  is a compressed
  //      file and the compression used.
  //
  //    compression : cardinal
  //      Compression factor (1 .. 4); (See Compress for info).
  //
  //    showProgress : boolean
  //      Show  a  device  (propeller)  which  indicates  compression in
  //      progress.
  //
  //  EXIT -
  //
  //    bytesIn : ModSys.INT32
  //      Number of bytes compressed from the input file. (File size)
  //
  //    bytesOut : ModSys.INT32
  //      Number of  bytes in the  compressed file. A  compression ratio
  //      can be calculated from this information.
  //
  //    status : cardinal
  //      Number indicating the status of the compression result.
  //        0 - No error occurred
  //        1 - Could not open input file
  //        2 - Could not open output file
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //




  procedure CompressFile
             (const fileIn       : string;
              const fileOut      : string;
              const compression  : cardinal;
              const showProgress : boolean;
              var   bytesIn      : ModSys.INT32;
              var   bytesOut     : ModSys.INT32;
              var   Status       : cardinal); overload; stdcall;

  exports CompressFile (const fileIn       : string;
                        const fileOut      : string;
                        const compression  : cardinal;
                        const showProgress : boolean;
                        var   bytesIn      : ModSys.INT32;
                        var   bytesOut     : ModSys.INT32;
                        var   Status       : cardinal) name 'Compress_STRCompressFile';

  //*
  //  STRCompressFile - See documentation of CompressFile.
  //




  procedure UnCompressFile
             (const fileIn       : array of char;
              const fileOut      : array of char;
              const showProgress : boolean;
              var   Status       : cardinal); overload; stdcall;

  exports UnCompressFile (const fileIn       : array of char;
                          const fileOut      : array of char;
                          const showProgress : boolean;
                          var   Status       : cardinal) name 'Compress_UnCompressFile';

  //*
  //  UnCompressFile - Uncompress a compressed file to another file.
  //
  //
  //  This  routine will  use the  UnCompress procedure,  read the input
  //  compressed file,  uncompress the data  and write the  uncompressed
  //  data to another file.
  //
  //  CALLING SEQUENCE -
  //
  //    UnCompressFile (fileIn, fileOut, status);
  //
  //  ENTRY -
  //
  //    fileIn : array of char
  //      File name  of file to  be uncompressed. Must  include any path
  //      information  if needed.  The file  must be  a file  compressed
  //      using the CompressFile routine above.
  //
  //    fileOut : array of char
  //      File  name  of  the  uncomressed  file.  Must include any path
  //      information if needed.
  //
  //    showProgress : boolean
  //      Show  a  device  (propeller)  which  indicates  compression in
  //      progress.
  //
  //  EXIT -
  //
  //    status : cardinal
  //      Number indicating the status of the uncompression result.
  //        0 - No error occurred
  //        1 - Could not open input file
  //        2 - Could not open output file
  //        3 - Not a compressed file
  //        4 - Error putting output buffer
  //        5 - Work buffer too small
  //




  procedure UnCompressFile
             (const fileIn       : string;
              const fileOut      : string;
              const showProgress : boolean;
              var   Status       : cardinal); overload; stdcall;

  exports UnCompressFile (const fileIn       : string;
                          const fileOut      : string;
                          const showProgress : boolean;
                          var   Status       : cardinal) name 'Compress_STRUnCompressFile';

  //*
  //  STRUnCompressFile - See documentation of UnCompressFile.
  //




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance