bzip2.bmx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ' Copyright (c) 2022 Bruce A Henderson
  2. ' All rights reserved.
  3. '
  4. ' Redistribution and use in source and binary forms, with or without
  5. ' modification, are permitted provided that the following conditions are met:
  6. ' * Redistributions of source code must retain the above copyright
  7. ' notice, this list of conditions and the following disclaimer.
  8. ' * Redistributions in binary form must reproduce the above copyright
  9. ' notice, this list of conditions and the following disclaimer in the
  10. ' documentation and/or other materials provided with the distribution.
  11. '
  12. ' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY
  13. ' EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  14. ' WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  15. ' DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
  16. ' DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  17. ' (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  18. ' LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ' ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  20. ' (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  21. ' SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. '
  23. SuperStrict
  24. Module Archive.BZip2
  25. ModuleInfo "CC_OPTS: -DBZ2_STATICLIB -DHAVE_BZLIB_H -DBZ_CONFIG_ERROR"
  26. ModuleInfo "CC_OPTS: -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64"
  27. ?win32
  28. ModuleInfo "CC_OPTS: -DLIBARCHIVE_STATIC"
  29. ?
  30. Import "common.bmx"
  31. Private
  32. Type TBZip2ArchiveFormat Extends TArchiveFormat
  33. Method AddReadFormat:Int(archive:Byte Ptr, format:EArchiveFormat)
  34. Return False
  35. End Method
  36. Method AddWriteFormat:Int(archive:Byte Ptr, format:EArchiveFormat)
  37. Return False
  38. End Method
  39. Method AddReadFilter:Int(archive:Byte Ptr, filter:EArchiveFilter)
  40. If filter = EArchiveFilter.BZIP2 Then
  41. archive_read_support_filter_bzip2(archive)
  42. Return True
  43. End If
  44. End Method
  45. Method AddWriteFilter:Int(archive:Byte Ptr, filter:EArchiveFilter)
  46. If filter = EArchiveFilter.BZIP2 Then
  47. archive_write_add_filter_bzip2(archive)
  48. Return True
  49. End If
  50. End Method
  51. End Type
  52. New TBZip2ArchiveFormat