@papyrus-sdk/engine-native 0.2.22-beta.2 → 0.2.22-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/android/build.gradle +1 -0
  2. package/android/src/main/cpp/CMakeLists.txt +137 -0
  3. package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
  4. package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
  5. package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
  6. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +353 -0
  7. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
  8. package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +17 -0
  9. package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +298 -34
  10. package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
  11. package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
  12. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +24 -0
  13. package/android/src/main/java/com/papyrus/engine/PapyrusRenderMath.java +9 -0
  14. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +439 -0
  15. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +43 -0
  16. package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
  17. package/dist/index.d.mts +439 -3
  18. package/dist/index.d.ts +439 -3
  19. package/dist/index.js +412 -4
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +404 -3
  22. package/dist/index.mjs.map +1 -1
  23. package/ios/PapyrusComicDocumentView.h +21 -0
  24. package/ios/PapyrusComicDocumentView.m +374 -0
  25. package/ios/PapyrusComicDocumentViewManager.m +23 -0
  26. package/ios/PapyrusEngineStore.m +4 -0
  27. package/ios/PapyrusNativeEngine.m +664 -0
  28. package/ios/PapyrusNativeEngine.podspec +26 -1
  29. package/ios/PapyrusPageRotationRegistry.h +29 -0
  30. package/ios/PapyrusPageRotationRegistry.m +179 -0
  31. package/ios/PapyrusPageView.m +38 -11
  32. package/ios/PapyrusPdfDocumentView.h +2 -0
  33. package/ios/PapyrusPdfDocumentView.m +116 -9
  34. package/ios/PapyrusPdfDocumentViewManager.m +2 -0
  35. package/ios/PapyrusPdfPageTheme.h +15 -0
  36. package/ios/PapyrusPdfPageTheme.m +218 -0
  37. package/ios/PapyrusTextDocumentView.h +27 -0
  38. package/ios/PapyrusTextDocumentView.m +300 -0
  39. package/ios/PapyrusTextDocumentViewManager.m +29 -0
  40. package/ios/PapyrusTextStore.h +13 -0
  41. package/ios/PapyrusTextStore.m +73 -0
  42. package/package.json +5 -3
  43. package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
  44. package/third_party_licenses/libarchive-COPYING +65 -0
  45. package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
  46. package/vendor/libarchive/PapyrusComicArchive.h +30 -0
  47. package/vendor/libarchive/README.papyrus.md +15 -0
  48. package/vendor/libarchive/android.h +192 -0
  49. package/vendor/libarchive/config/PapyrusArchiveConfig.h +65 -0
  50. package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
  51. package/vendor/libarchive/libarchive/android_lf.h +36 -0
  52. package/vendor/libarchive/libarchive/archive.h +1266 -0
  53. package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
  54. package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
  55. package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
  56. package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
  57. package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
  58. package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
  59. package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
  60. package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
  61. package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
  62. package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
  63. package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
  64. package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
  65. package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
  66. package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
  67. package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
  68. package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
  69. package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
  70. package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
  71. package/vendor/libarchive/libarchive/archive_endian.h +234 -0
  72. package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
  73. package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
  74. package/vendor/libarchive/libarchive/archive_entry.h +763 -0
  75. package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
  76. package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
  77. package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
  78. package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
  79. package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
  80. package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
  81. package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
  82. package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
  83. package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
  84. package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
  85. package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
  86. package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
  87. package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
  88. package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
  89. package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
  90. package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
  91. package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
  92. package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
  93. package/vendor/libarchive/libarchive/archive_integer.h +267 -0
  94. package/vendor/libarchive/libarchive/archive_match.c +1869 -0
  95. package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
  96. package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
  97. package/vendor/libarchive/libarchive/archive_options.c +219 -0
  98. package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
  99. package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
  100. package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
  101. package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
  102. package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
  103. package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
  104. package/vendor/libarchive/libarchive/archive_platform.h +213 -0
  105. package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
  106. package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
  107. package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
  108. package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
  109. package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
  110. package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
  111. package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
  112. package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
  113. package/vendor/libarchive/libarchive/archive_private.h +209 -0
  114. package/vendor/libarchive/libarchive/archive_random.c +274 -0
  115. package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
  116. package/vendor/libarchive/libarchive/archive_rb.c +709 -0
  117. package/vendor/libarchive/libarchive/archive_rb.h +113 -0
  118. package/vendor/libarchive/libarchive/archive_read.3 +250 -0
  119. package/vendor/libarchive/libarchive/archive_read.c +1814 -0
  120. package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
  121. package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
  122. package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
  123. package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
  124. package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
  125. package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
  126. package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  127. package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
  128. package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
  129. package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
  130. package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
  131. package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
  132. package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
  133. package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
  134. package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
  135. package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
  136. package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
  137. package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
  138. package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
  139. package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
  140. package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
  141. package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
  142. package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
  143. package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
  144. package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
  145. package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
  146. package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
  147. package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
  148. package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
  149. package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
  150. package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
  151. package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
  152. package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
  153. package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
  154. package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
  155. package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
  156. package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
  157. package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
  158. package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
  159. package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
  160. package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
  161. package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
  162. package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
  163. package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
  164. package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
  165. package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
  166. package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
  167. package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
  168. package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
  169. package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
  170. package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
  171. package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
  172. package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
  173. package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
  174. package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
  175. package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
  176. package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
  177. package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
  178. package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
  179. package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
  180. package/vendor/libarchive/libarchive/archive_string.c +4391 -0
  181. package/vendor/libarchive/libarchive/archive_string.h +244 -0
  182. package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
  183. package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
  184. package/vendor/libarchive/libarchive/archive_time.c +168 -0
  185. package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
  186. package/vendor/libarchive/libarchive/archive_util.3 +239 -0
  187. package/vendor/libarchive/libarchive/archive_util.c +668 -0
  188. package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
  189. package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
  190. package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
  191. package/vendor/libarchive/libarchive/archive_windows.h +332 -0
  192. package/vendor/libarchive/libarchive/archive_write.3 +266 -0
  193. package/vendor/libarchive/libarchive/archive_write.c +896 -0
  194. package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
  195. package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
  196. package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
  197. package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
  198. package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
  199. package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
  200. package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
  201. package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
  202. package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
  203. package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
  204. package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
  205. package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
  206. package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
  207. package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
  208. package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
  209. package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
  210. package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
  211. package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
  212. package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
  213. package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
  214. package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
  215. package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
  216. package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
  217. package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
  218. package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
  219. package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
  220. package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
  221. package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
  222. package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
  223. package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
  224. package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
  225. package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
  226. package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
  227. package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
  228. package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
  229. package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
  230. package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
  231. package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
  232. package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
  233. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
  234. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  235. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
  236. package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
  237. package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
  238. package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
  239. package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
  240. package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
  241. package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
  242. package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
  243. package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
  244. package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
  245. package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
  246. package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
  247. package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
  248. package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
  249. package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
  250. package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
  251. package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
  252. package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
  253. package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
  254. package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
  255. package/vendor/libarchive/libarchive/cpio.5 +389 -0
  256. package/vendor/libarchive/libarchive/filter_fork.h +44 -0
  257. package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
  258. package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
  259. package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
  260. package/vendor/libarchive/libarchive/libarchive.3 +297 -0
  261. package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
  262. package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
  263. package/vendor/libarchive/libarchive/module.modulemap +34 -0
  264. package/vendor/libarchive/libarchive/mtree.5 +323 -0
  265. package/vendor/libarchive/libarchive/tar.5 +947 -0
  266. package/vendor/libarchive/libarchive/xxhash.c +531 -0
@@ -0,0 +1,363 @@
1
+ .\" Copyright (c) 2003-2007 Tim Kientzle
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
6
+ .\" are met:
7
+ .\" 1. Redistributions of source code must retain the above copyright
8
+ .\" notice, this list of conditions and the following disclaimer.
9
+ .\" 2. Redistributions in binary form must reproduce the above copyright
10
+ .\" notice, this list of conditions and the following disclaimer in the
11
+ .\" documentation and/or other materials provided with the distribution.
12
+ .\"
13
+ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
+ .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
+ .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
+ .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
+ .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
+ .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
+ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
+ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
+ .\" SUCH DAMAGE.
24
+ .\"
25
+ .Dd January 26, 2011
26
+ .Dt LIBARCHIVE_INTERNALS 3
27
+ .Os
28
+ .Sh NAME
29
+ .Nm libarchive_internals
30
+ .Nd description of libarchive internal interfaces
31
+ .Sh OVERVIEW
32
+ The
33
+ .Nm libarchive
34
+ library provides a flexible interface for reading and writing
35
+ streaming archive files such as tar and cpio.
36
+ Internally, it follows a modular layered design that should
37
+ make it easy to add new archive and compression formats.
38
+ .Sh GENERAL ARCHITECTURE
39
+ Externally, libarchive exposes most operations through an
40
+ opaque, object-style interface.
41
+ The
42
+ .Xr archive_entry 3
43
+ objects store information about a single filesystem object.
44
+ The rest of the library provides facilities to write
45
+ .Xr archive_entry 3
46
+ objects to archive files,
47
+ read them from archive files,
48
+ and write them to disk.
49
+ (There are plans to add a facility to read
50
+ .Xr archive_entry 3
51
+ objects from disk as well.)
52
+ .Pp
53
+ The read and write APIs each have four layers: a public API
54
+ layer, a format layer that understands the archive file format,
55
+ a compression layer, and an I/O layer.
56
+ The I/O layer is completely exposed to clients who can replace
57
+ it entirely with their own functions.
58
+ .Pp
59
+ In order to provide as much consistency as possible for clients,
60
+ some public functions are virtualized.
61
+ Eventually, it should be possible for clients to open
62
+ an archive or disk writer, and then use a single set of
63
+ code to select and write entries, regardless of the target.
64
+ .Sh READ ARCHITECTURE
65
+ From the outside, clients use the
66
+ .Xr archive_read 3
67
+ API to manipulate an
68
+ .Nm archive
69
+ object to read entries and bodies from an archive stream.
70
+ Internally, the
71
+ .Nm archive
72
+ object is cast to an
73
+ .Nm archive_read
74
+ object, which holds all read-specific data.
75
+ The API has four layers:
76
+ The lowest layer is the I/O layer.
77
+ This layer can be overridden by clients, but most clients use
78
+ the packaged I/O callbacks provided, for example, by
79
+ .Xr archive_read_open_memory 3 ,
80
+ and
81
+ .Xr archive_read_open_fd 3 .
82
+ The compression layer calls the I/O layer to
83
+ read bytes and decompresses them for the format layer.
84
+ The format layer unpacks a stream of uncompressed bytes and
85
+ creates
86
+ .Nm archive_entry
87
+ objects from the incoming data.
88
+ The API layer tracks overall state
89
+ (for example, it prevents clients from reading data before reading a header)
90
+ and invokes the format and compression layer operations
91
+ through registered function pointers.
92
+ In particular, the API layer drives the format-detection process:
93
+ When opening the archive, it reads an initial block of data
94
+ and offers it to each registered compression handler.
95
+ The one with the highest bid is initialized with the first block.
96
+ Similarly, the format handlers are polled to see which handler
97
+ is the best for each archive.
98
+ (Prior to 2.4.0, the format bidders were invoked for each
99
+ entry, but this design hindered error recovery.)
100
+ .Ss I/O Layer and Client Callbacks
101
+ The read API goes to some lengths to be nice to clients.
102
+ As a result, there are few restrictions on the behavior of
103
+ the client callbacks.
104
+ .Pp
105
+ The client read callback is expected to provide a block
106
+ of data on each call.
107
+ A zero-length return does indicate end of file, but otherwise
108
+ blocks may be as small as one byte or as large as the entire file.
109
+ In particular, blocks may be of different sizes.
110
+ .Pp
111
+ The client skip callback returns the number of bytes actually
112
+ skipped, which may be much smaller than the skip requested.
113
+ The only requirement is that the skip not be larger.
114
+ In particular, clients are allowed to return zero for any
115
+ skip that they don't want to handle.
116
+ The skip callback must never be invoked with a negative value.
117
+ .Pp
118
+ Keep in mind that not all clients are reading from disk:
119
+ clients reading from networks may provide different-sized
120
+ blocks on every request and cannot skip at all;
121
+ advanced clients may use
122
+ .Xr mmap 2
123
+ to read the entire file into memory at once and return the
124
+ entire file to libarchive as a single block;
125
+ other clients may begin asynchronous I/O operations for the
126
+ next block on each request.
127
+ .Ss Decompression Layer
128
+ The decompression layer not only handles decompression,
129
+ it also buffers data so that the format handlers see a
130
+ much nicer I/O model.
131
+ The decompression API is a two stage peek/consume model.
132
+ A read_ahead request specifies a minimum read amount;
133
+ the decompression layer must provide a pointer to at least
134
+ that much data.
135
+ If more data is immediately available, it should return more:
136
+ the format layer handles bulk data reads by asking for a minimum
137
+ of one byte and then copying as much data as is available.
138
+ .Pp
139
+ A subsequent call to the
140
+ .Fn consume
141
+ function advances the read pointer.
142
+ Note that data returned from a
143
+ .Fn read_ahead
144
+ call is guaranteed to remain in place until
145
+ the next call to
146
+ .Fn read_ahead .
147
+ Intervening calls to
148
+ .Fn consume
149
+ should not cause the data to move.
150
+ .Pp
151
+ Skip requests must always be handled exactly.
152
+ Decompression handlers that cannot seek forward should
153
+ not register a skip handler;
154
+ the API layer fills in a generic skip handler that reads and discards data.
155
+ .Pp
156
+ A decompression handler has a specific lifecycle:
157
+ .Bl -tag -compact -width indent
158
+ .It Registration/Configuration
159
+ When the client invokes the public support function,
160
+ the decompression handler invokes the internal
161
+ .Fn __archive_read_register_compression
162
+ function to provide bid and initialization functions.
163
+ This function returns
164
+ .Cm NULL
165
+ on error or else a pointer to a
166
+ .Cm struct decompressor_t .
167
+ This structure contains a
168
+ .Va void * config
169
+ slot that can be used for storing any customization information.
170
+ .It Bid
171
+ The bid function is invoked with a pointer and size of a block of data.
172
+ The decompressor can access its config data
173
+ through the
174
+ .Va decompressor
175
+ element of the
176
+ .Cm archive_read
177
+ object.
178
+ The bid function is otherwise stateless.
179
+ In particular, it must not perform any I/O operations.
180
+ .Pp
181
+ The value returned by the bid function indicates its suitability
182
+ for handling this data stream.
183
+ A bid of zero will ensure that this decompressor is never invoked.
184
+ Return zero if magic number checks fail.
185
+ Otherwise, your initial implementation should return the number of bits
186
+ actually checked.
187
+ For example, if you verify two full bytes and three bits of another
188
+ byte, bid 19.
189
+ Note that the initial block may be very short;
190
+ be careful to only inspect the data you are given.
191
+ (The current decompressors require two bytes for correct bidding.)
192
+ .It Initialize
193
+ The winning bidder will have its init function called.
194
+ This function should initialize the remaining slots of the
195
+ .Va struct decompressor_t
196
+ object pointed to by the
197
+ .Va decompressor
198
+ element of the
199
+ .Va archive_read
200
+ object.
201
+ In particular, it should allocate any working data it needs
202
+ in the
203
+ .Va data
204
+ slot of that structure.
205
+ The init function is called with the block of data that
206
+ was used for tasting.
207
+ At this point, the decompressor is responsible for all I/O
208
+ requests to the client callbacks.
209
+ The decompressor is free to read more data as and when
210
+ necessary.
211
+ .It Satisfy I/O requests
212
+ The format handler will invoke the
213
+ .Va read_ahead ,
214
+ .Va consume ,
215
+ and
216
+ .Va skip
217
+ functions as needed.
218
+ .It Finish
219
+ The finish method is called only once when the archive is closed.
220
+ It should release anything stored in the
221
+ .Va data
222
+ and
223
+ .Va config
224
+ slots of the
225
+ .Va decompressor
226
+ object.
227
+ It should not invoke the client close callback.
228
+ .El
229
+ .Ss Format Layer
230
+ The read formats have a similar lifecycle to the decompression handlers:
231
+ .Bl -tag -compact -width indent
232
+ .It Registration
233
+ Allocate your private data and initialize your pointers.
234
+ .It Bid
235
+ Formats bid by invoking the
236
+ .Fn read_ahead
237
+ decompression method but not calling the
238
+ .Fn consume
239
+ method.
240
+ This allows each bidder to look ahead in the input stream.
241
+ Bidders should not look further ahead than necessary, as long
242
+ look aheads put pressure on the decompression layer to buffer
243
+ lots of data.
244
+ Most formats only require a few hundred bytes of look ahead;
245
+ look aheads of a few kilobytes are reasonable.
246
+ (The ISO9660 reader sometimes looks ahead by 48k, which
247
+ should be considered an upper limit.)
248
+ .It Read header
249
+ The header read is usually the most complex part of any format.
250
+ There are a few strategies worth mentioning:
251
+ For formats such as tar or cpio, reading and parsing the header is
252
+ straightforward since headers alternate with data.
253
+ For formats that store all header data at the beginning of the file,
254
+ the first header read request may have to read all headers into
255
+ memory and store that data, sorted by the location of the file
256
+ data.
257
+ Subsequent header read requests will skip forward to the
258
+ beginning of the file data and return the corresponding header.
259
+ .It Read Data
260
+ The read data interface supports sparse files; this requires that
261
+ each call return a block of data specifying the file offset and
262
+ size.
263
+ This may require you to carefully track the location so that you
264
+ can return accurate file offsets for each read.
265
+ Remember that the decompressor will return as much data as it has.
266
+ Generally, you will want to request one byte,
267
+ examine the return value to see how much data is available, and
268
+ possibly trim that to the amount you can use.
269
+ You should invoke consume for each block just before you return it.
270
+ .It Skip All Data
271
+ The skip data call should skip over all file data and trailing padding.
272
+ This is called automatically by the API layer just before each
273
+ header read.
274
+ It is also called in response to the client calling the public
275
+ .Fn data_skip
276
+ function.
277
+ .It Cleanup
278
+ On cleanup, the format should release all of its allocated memory.
279
+ .El
280
+ .Ss API Layer
281
+ XXX to do XXX
282
+ .Sh WRITE ARCHITECTURE
283
+ The write API has a similar set of four layers:
284
+ an API layer, a format layer, a compression layer, and an I/O layer.
285
+ The registration here is much simpler because only
286
+ one format and one compression can be registered at a time.
287
+ .Ss I/O Layer and Client Callbacks
288
+ XXX To be written XXX
289
+ .Ss Compression Layer
290
+ XXX To be written XXX
291
+ .Ss Format Layer
292
+ XXX To be written XXX
293
+ .Ss API Layer
294
+ XXX To be written XXX
295
+ .Sh WRITE_DISK ARCHITECTURE
296
+ The write_disk API is intended to look just like the write API
297
+ to clients.
298
+ Since it does not handle multiple formats or compression, it
299
+ is not layered internally.
300
+ .Sh GENERAL SERVICES
301
+ The
302
+ .Nm archive_read ,
303
+ .Nm archive_write ,
304
+ and
305
+ .Nm archive_write_disk
306
+ objects all contain an initial
307
+ .Nm archive
308
+ object which provides common support for a set of standard services.
309
+ (Recall that ANSI/ISO C90 guarantees that you can cast freely between
310
+ a pointer to a structure and a pointer to the first element of that
311
+ structure.)
312
+ The
313
+ .Nm archive
314
+ object has a magic value that indicates which API this object
315
+ is associated with,
316
+ slots for storing error information,
317
+ and function pointers for virtualized API functions.
318
+ .Sh MISCELLANEOUS NOTES
319
+ Connecting existing archiving libraries into libarchive is generally
320
+ quite difficult.
321
+ In particular, many existing libraries strongly assume that you
322
+ are reading from a file; they seek forwards and backwards as necessary
323
+ to locate various pieces of information.
324
+ In contrast, libarchive never seeks backwards in its input, which
325
+ sometimes requires very different approaches.
326
+ .Pp
327
+ For example, libarchive's ISO9660 support operates very differently
328
+ from most ISO9660 readers.
329
+ The libarchive support utilizes a work-queue design that
330
+ keeps a list of known entries sorted by their location in the input.
331
+ Whenever libarchive's ISO9660 implementation is asked for the next
332
+ header, checks this list to find the next item on the disk.
333
+ Directories are parsed when they are encountered and new
334
+ items are added to the list.
335
+ This design relies heavily on the ISO9660 image being optimized so that
336
+ directories always occur earlier on the disk than the files they
337
+ describe.
338
+ .Pp
339
+ Depending on the specific format, such approaches may not be possible.
340
+ The ZIP format specification, for example, allows archivers to store
341
+ key information only at the end of the file.
342
+ In theory, it is possible to create ZIP archives that cannot
343
+ be read without seeking.
344
+ Fortunately, such archives are very rare, and libarchive can read
345
+ most ZIP archives, though it cannot always extract as much information
346
+ as a dedicated ZIP program.
347
+ .Sh SEE ALSO
348
+ .Xr archive_entry 3 ,
349
+ .Xr archive_read 3 ,
350
+ .Xr archive_write 3 ,
351
+ .Xr archive_write_disk 3 ,
352
+ .Xr libarchive 3
353
+ .Sh HISTORY
354
+ The
355
+ .Nm libarchive
356
+ library first appeared in
357
+ .Fx 5.3 .
358
+ .Sh AUTHORS
359
+ .An -nosplit
360
+ The
361
+ .Nm libarchive
362
+ library was written by
363
+ .An Tim Kientzle Aq kientzle@acm.org .
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Clang Module Map for libarchive
3
+ *
4
+ * What this is:
5
+ * This file tells the Clang compiler how to treat libarchive as a "module" -
6
+ * a self-contained unit of code that can be imported all at once instead of
7
+ * including individual header files. Think of it like a package definition.
8
+ *
9
+ * How it works:
10
+ * - When you write `@import CArchive` (Objective-C) or `import CArchive` (Swift),
11
+ * the compiler uses this file to know which headers belong to libarchive
12
+ * - Instead of processing each #include separately, the compiler can load a
13
+ * pre-compiled version of the entire library, making builds faster
14
+ * - This also provides better dependency tracking and can catch issues like
15
+ * conflicting macro definitions between libraries
16
+ *
17
+ * When to update:
18
+ * Update this file whenever:
19
+ * - New public header files are added to libarchive's libarchive/ directory
20
+ * - Public headers are removed or renamed
21
+ * - The library's API structure changes significantly
22
+ *
23
+ * You typically don't need to update this for:
24
+ * - Internal implementation changes
25
+ * - Private/internal header modifications
26
+ * - Documentation updates
27
+ *
28
+ * NOTE: This only affects projects using Clang with modules enabled. Traditional
29
+ * #include-based builds will continue to work normally with or without this file.
30
+ */
31
+ module CArchive {
32
+ header "archive.h"
33
+ header "archive_entry.h"
34
+ }