home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxgzlib.zip / tstgzlib.cmd < prev   
OS/2 REXX Batch file  |  1999-12-20  |  2KB  |  69 lines

  1. /* Simple demo of RxGZlib Functions. Requires an hpfs drive (for multi-extension file names) */
  2.  
  3. /* Load the rxGZlib functions */
  4. if rxfuncquery('rxgzLoadFuncs') then do
  5.    foo=RxFuncAdd( 'rxgzLoadFuncs', 'RXGZLIB', 'rxgzLoadFuncs')
  6.    if foo=0 then do
  7.       call rxgzLoadFuncs
  8.    end
  9.    else do
  10.       say "Sorry, rxGZlib.dll is not available"
  11.       exit
  12.    end /* do */
  13. end /* if */
  14.  
  15. call charout,'Enter an input file: '
  16. pull input_file
  17. if input_file='' then do
  18.   input_file="tstgzlib.cmd"
  19.   say ' ... using 'input_file
  20. end
  21.  
  22. say "--- Testing file deflation procedures  --- "
  23. say "Size of  original file: "||stream(input_file,'c','query size')
  24.  
  25. rc=rxgzDeflateFile(Input_file, Input_file".gz")
  26. newsize=stream(input_file".gz",'c','query size')
  27. say 'rxgzDeflateFile to 'input_file'.gz. Code = 'rc ||'. File size='||newsize
  28.  
  29. rc=rxgzDeflateFile(Input_file, Input_file"_1.gz", "9")
  30. newsize=stream(input_file"_1.gz",'c','query size')
  31. say 'rxDeflateFile to 'input_file'_1.gz, option=9. Code = 'rc ||'. File size='||newsize
  32.  
  33. rc=rxgzDeflateFile(Input_file, Input_file"_2.gz", "2")
  34. newsize=stream(input_file"_2.gz",'c','query size')
  35. say 'rxDeflateFile to 'Input_file'_2.gz , option=2. Code = 'rc ||'. File size='||newsize
  36.  
  37. say
  38. rc=rxgzInflateFile(Input_file".gz", Input_file"_1")
  39. newsize=stream(input_file"_1",'c','query size')
  40. say 'rxInflateFile  'Input_file'.gz to 'input_File'_1.'
  41. say '      Code = 'rc ||'. File size='||newsize
  42. say
  43. say "--- Testing string deflation procedures  --- "
  44.  
  45.  
  46. InStr="Mary had a little lamb, it's fleece was white as snow, everywhere that Mary went the lamb was sure to go"
  47.  
  48. CompStr=rxgzDeflateString(InStr)
  49. say "rxgzDeflatestring. In: "length(instr)"  Out: "length(CompStr)
  50. NewStr=rxgzInflateString(CompStr)
  51. say "rxgzInflateStringIn. "length(Compstr)"  Out: "length(NewStr)
  52. say Instr
  53. say NewStr
  54.  
  55. /*
  56. astring=charin(input_file,1,chars(input_file))
  57. rc=stream(Input_file,'c','close')
  58.  
  59. deflated=rxgzDeflateString(astring)
  60. inflated=rxgzInflateString(deflated)
  61.  
  62. output_file=Input_file'_5'
  63. rc=charout(output_file,inflated,1)
  64. rc=stream(output_file,'c','close')
  65. */
  66.  
  67. call rxgzUnloadFuncs
  68.  
  69.