physfs_internal.h 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  1. /*
  2. * Internal function/structure declaration. Do NOT include in your
  3. * application.
  4. *
  5. * Please see the file LICENSE in the source's root directory.
  6. *
  7. * This file written by Ryan C. Gordon.
  8. */
  9. #ifndef _INCLUDE_PHYSFS_INTERNAL_H_
  10. #define _INCLUDE_PHYSFS_INTERNAL_H_
  11. #ifndef __PHYSICSFS_INTERNAL__
  12. #error Do not include this header from your applications.
  13. #endif
  14. #include "physfs.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* The LANG section. */
  19. /* please send questions/translations to Ryan: icculus@clutteredmind.org. */
  20. #if (!defined PHYSFS_LANG)
  21. # define PHYSFS_LANG PHYSFS_LANG_ENGLISH
  22. #endif
  23. #define PHYSFS_LANG_ENGLISH 1 /* English text by Ryan C. Gordon */
  24. #define PHYSFS_LANG_RUSSIAN_KOI8_R 2 /* Russian text by Ed Sinjiashvili */
  25. #define PHYSFS_LANG_SPANISH 3 /* Spanish text by Pedro J. Pérez */
  26. #define PHYSFS_LANG_FRENCH 4 /* French text by Stéphane Peter */
  27. #if (PHYSFS_LANG == PHYSFS_LANG_ENGLISH)
  28. #define DIR_ARCHIVE_DESCRIPTION "Non-archive, direct filesystem I/O"
  29. #define GRP_ARCHIVE_DESCRIPTION "Build engine Groupfile format"
  30. #define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip compatible"
  31. #define ERR_IS_INITIALIZED "Already initialized"
  32. #define ERR_NOT_INITIALIZED "Not initialized"
  33. #define ERR_INVALID_ARGUMENT "Invalid argument"
  34. #define ERR_FILES_STILL_OPEN "Files still open"
  35. #define ERR_NO_DIR_CREATE "Failed to create directories"
  36. #define ERR_OUT_OF_MEMORY "Out of memory"
  37. #define ERR_NOT_IN_SEARCH_PATH "No such entry in search path"
  38. #define ERR_NOT_SUPPORTED "Operation not supported"
  39. #define ERR_UNSUPPORTED_ARCHIVE "Archive type unsupported"
  40. #define ERR_NOT_A_HANDLE "Not a file handle"
  41. #define ERR_INSECURE_FNAME "Insecure filename"
  42. #define ERR_SYMLINK_DISALLOWED "Symbolic links are disabled"
  43. #define ERR_NO_WRITE_DIR "Write directory is not set"
  44. #define ERR_NO_SUCH_FILE "File not found"
  45. #define ERR_NO_SUCH_PATH "Path not found"
  46. #define ERR_NO_SUCH_VOLUME "Volume not found"
  47. #define ERR_PAST_EOF "Past end of file"
  48. #define ERR_ARC_IS_READ_ONLY "Archive is read-only"
  49. #define ERR_IO_ERROR "I/O error"
  50. #define ERR_CANT_SET_WRITE_DIR "Can't set write directory"
  51. #define ERR_SYMLINK_LOOP "Infinite symbolic link loop"
  52. #define ERR_COMPRESSION "(De)compression error"
  53. #define ERR_NOT_IMPLEMENTED "Not implemented"
  54. #define ERR_OS_ERROR "Operating system reported error"
  55. #define ERR_FILE_EXISTS "File already exists"
  56. #define ERR_NOT_A_FILE "Not a file"
  57. #define ERR_NOT_A_DIR "Not a directory"
  58. #define ERR_NOT_AN_ARCHIVE "Not an archive"
  59. #define ERR_CORRUPTED "Corrupted archive"
  60. #define ERR_SEEK_OUT_OF_RANGE "Seek out of range"
  61. #define ERR_BAD_FILENAME "Bad filename"
  62. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS made a bad system call"
  63. #define ERR_ARGV0_IS_NULL "argv0 is NULL"
  64. #define ERR_ZLIB_NEED_DICT "zlib: need dictionary"
  65. #define ERR_ZLIB_DATA_ERROR "zlib: data error"
  66. #define ERR_ZLIB_MEMORY_ERROR "zlib: memory error"
  67. #define ERR_ZLIB_BUFFER_ERROR "zlib: buffer error"
  68. #define ERR_ZLIB_VERSION_ERROR "zlib: version error"
  69. #define ERR_ZLIB_UNKNOWN_ERROR "zlib: unknown error"
  70. #define ERR_SEARCHPATH_TRUNC "Search path was truncated"
  71. #define ERR_GETMODFN_TRUNC "GetModuleFileName() was truncated"
  72. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() had no dir"
  73. #define ERR_DISK_FULL "Disk is full"
  74. #define ERR_DIRECTORY_FULL "Directory full"
  75. #define ERR_MACOS_GENERIC "MacOS reported error (%d)"
  76. #define ERR_OS2_GENERIC "OS/2 reported error (%d)"
  77. #define ERR_VOL_LOCKED_HW "Volume is locked through hardware"
  78. #define ERR_VOL_LOCKED_SW "Volume is locked through software"
  79. #define ERR_FILE_LOCKED "File is locked"
  80. #define ERR_FILE_OR_DIR_BUSY "File/directory is busy"
  81. #define ERR_FILE_ALREADY_OPEN_W "File already open for writing"
  82. #define ERR_FILE_ALREADY_OPEN_R "File already open for reading"
  83. #define ERR_INVALID_REFNUM "Invalid reference number"
  84. #define ERR_GETTING_FILE_POS "Error getting file position"
  85. #define ERR_VOLUME_OFFLINE "Volume is offline"
  86. #define ERR_PERMISSION_DENIED "Permission denied"
  87. #define ERR_VOL_ALREADY_ONLINE "Volume already online"
  88. #define ERR_NO_SUCH_DRIVE "No such drive"
  89. #define ERR_NOT_MAC_DISK "Not a Macintosh disk"
  90. #define ERR_VOL_EXTERNAL_FS "Volume belongs to an external filesystem"
  91. #define ERR_PROBLEM_RENAME "Problem during rename"
  92. #define ERR_BAD_MASTER_BLOCK "Bad master directory block"
  93. #define ERR_CANT_MOVE_FORBIDDEN "Attempt to move forbidden"
  94. #define ERR_WRONG_VOL_TYPE "Wrong volume type"
  95. #define ERR_SERVER_VOL_LOST "Server volume has been disconnected"
  96. #define ERR_FILE_ID_NOT_FOUND "File ID not found"
  97. #define ERR_FILE_ID_EXISTS "File ID already exists"
  98. #define ERR_SERVER_NO_RESPOND "Server not responding"
  99. #define ERR_USER_AUTH_FAILED "User authentication failed"
  100. #define ERR_PWORD_EXPIRED "Password has expired on server"
  101. #define ERR_ACCESS_DENIED "Access denied"
  102. #define ERR_NOT_A_DOS_DISK "Not a DOS disk"
  103. #define ERR_SHARING_VIOLATION "Sharing violation"
  104. #define ERR_CANNOT_MAKE "Cannot make"
  105. #define ERR_DEV_IN_USE "Device already in use"
  106. #define ERR_OPEN_FAILED "Open failed"
  107. #define ERR_PIPE_BUSY "Pipe is busy"
  108. #define ERR_SHARING_BUF_EXCEEDED "Sharing buffer exceeded"
  109. #define ERR_TOO_MANY_HANDLES "Too many open handles"
  110. #define ERR_SEEK_ERROR "Seek error"
  111. #define ERR_DEL_CWD "Trying to delete current working directory"
  112. #define ERR_WRITE_PROTECT_ERROR "Write protect error"
  113. #define ERR_WRITE_FAULT "Write fault"
  114. #define ERR_LOCK_VIOLATION "Lock violation"
  115. #define ERR_GEN_FAILURE "General failure"
  116. #define ERR_UNCERTAIN_MEDIA "Uncertain media"
  117. #define ERR_PROT_VIOLATION "Protection violation"
  118. #define ERR_BROKEN_PIPE "Broken pipe"
  119. #elif (PHYSFS_LANG == PHYSFS_LANG_RUSSIAN_KOI8_R)
  120. #define DIR_ARCHIVE_DESCRIPTION "îÅ ÁÒÈÉ×, ÎÅÐÏÓÒÅÄÓÔ×ÅÎÎÙÊ ××ÏÄ/×Ù×ÏÄ ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÙ"
  121. #define GRP_ARCHIVE_DESCRIPTION "æÏÒÍÁÔ ÇÒÕÐÐÏ×ÏÇÏ ÆÁÊÌÁ Build engine"
  122. #define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip ÓÏ×ÍÅÓÔÉÍÙÊ"
  123. #define ERR_IS_INITIALIZED "õÖÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎ"
  124. #define ERR_NOT_INITIALIZED "îÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎ"
  125. #define ERR_INVALID_ARGUMENT "îÅ×ÅÒÎÙÊ ÁÒÇÕÍÅÎÔ"
  126. #define ERR_FILES_STILL_OPEN "æÁÊÌÙ ÅÝÅ ÏÔËÒÙÔÙ"
  127. #define ERR_NO_DIR_CREATE "îÅ ÍÏÇÕ ÓÏÚÄÁÔØ ËÁÔÁÌÏÇÉ"
  128. #define ERR_OUT_OF_MEMORY "ëÏÎÞÉÌÁÓØ ÐÁÍÑÔØ"
  129. #define ERR_NOT_IN_SEARCH_PATH "îÅÔ ÔÁËÏÇÏ ÜÌÅÍÅÎÔÁ × ÐÕÔÉ ÐÏÉÓËÁ"
  130. #define ERR_NOT_SUPPORTED "ïÐÅÒÁÃÉÑ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ"
  131. #define ERR_UNSUPPORTED_ARCHIVE "áÒÈÉ×Ù ÔÁËÏÇÏ ÔÉÐÁ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ"
  132. #define ERR_NOT_A_HANDLE "îÅ ÆÁÊÌÏ×ÙÊ ÄÅÓËÒÉÐÔÏÒ"
  133. #define ERR_INSECURE_FNAME "îÅÂÅÚÏÐÁÓÎÏÅ ÉÍÑ ÆÁÊÌÁ"
  134. #define ERR_SYMLINK_DISALLOWED "óÉÍ×ÏÌØÎÙÅ ÓÓÙÌËÉ ÏÔËÌÀÞÅÎÙ"
  135. #define ERR_NO_WRITE_DIR "ëÁÔÁÌÏÇ ÄÌÑ ÚÁÐÉÓÉ ÎÅ ÕÓÔÁÎÏ×ÌÅÎ"
  136. #define ERR_NO_SUCH_FILE "æÁÊÌ ÎÅ ÎÁÊÄÅÎ"
  137. #define ERR_NO_SUCH_PATH "ðÕÔØ ÎÅ ÎÁÊÄÅÎ"
  138. #define ERR_NO_SUCH_VOLUME "ôÏÍ ÎÅ ÎÁÊÄÅÎ"
  139. #define ERR_PAST_EOF "úÁ ËÏÎÃÏÍ ÆÁÊÌÁ"
  140. #define ERR_ARC_IS_READ_ONLY "áÒÈÉ× ÔÏÌØËÏ ÄÌÑ ÞÔÅÎÉÑ"
  141. #define ERR_IO_ERROR "ïÛÉÂËÁ ××ÏÄÁ/×Ù×ÏÄÁ"
  142. #define ERR_CANT_SET_WRITE_DIR "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ËÁÔÁÌÏÇ ÄÌÑ ÚÁÐÉÓÉ"
  143. #define ERR_SYMLINK_LOOP "âÅÓËÏÎÅÞÎÙÊ ÃÉËÌ ÓÉÍ×ÏÌØÎÏÊ ÓÓÙÌËÉ"
  144. #define ERR_COMPRESSION "ïÛÉÂËÁ (òÁÓ)ÐÁËÏ×ËÉ"
  145. #define ERR_NOT_IMPLEMENTED "îÅ ÒÅÁÌÉÚÏ×ÁÎÏ"
  146. #define ERR_OS_ERROR "ïÐÅÒÁÃÉÏÎÎÁÑ ÓÉÓÔÅÍÁ ÓÏÏÂÝÉÌÁ ÏÛÉÂËÕ"
  147. #define ERR_FILE_EXISTS "æÁÊÌ ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ"
  148. #define ERR_NOT_A_FILE "îÅ ÆÁÊÌ"
  149. #define ERR_NOT_A_DIR "îÅ ËÁÔÁÌÏÇ"
  150. #define ERR_NOT_AN_ARCHIVE "îÅ ÁÒÈÉ×"
  151. #define ERR_CORRUPTED "ðÏ×ÒÅÖÄÅÎÎÙÊ ÁÒÈÉ×"
  152. #define ERR_SEEK_OUT_OF_RANGE "ðÏÚÉÃÉÏÎÉÒÏ×ÁÎÉÅ ÚÁ ÐÒÅÄÅÌÙ"
  153. #define ERR_BAD_FILENAME "îÅ×ÅÒÎÏÅ ÉÍÑ ÆÁÊÌÁ"
  154. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS ×ÙÐÏÌÎÉÌÁ ÎÅ×ÅÒÎÙÊ ÓÉÓÔÅÍÎÙÊ ×ÙÚÏ×"
  155. #define ERR_ARGV0_IS_NULL "argv0 is NULL"
  156. #define ERR_ZLIB_NEED_DICT "zlib: ÎÕÖÅÎ ÓÌÏ×ÁÒØ"
  157. #define ERR_ZLIB_DATA_ERROR "zlib: ÏÛÉÂËÁ ÄÁÎÎÙÈ"
  158. #define ERR_ZLIB_MEMORY_ERROR "zlib: ÏÛÉÂËÁ ÐÁÍÑÔÉ"
  159. #define ERR_ZLIB_BUFFER_ERROR "zlib: ÏÛÉÂËÁ ÂÕÆÅÒÁ"
  160. #define ERR_ZLIB_VERSION_ERROR "zlib: ÏÛÉÂËÁ ×ÅÒÓÉÉ"
  161. #define ERR_ZLIB_UNKNOWN_ERROR "zlib: ÎÅÉÚ×ÅÓÔÎÁÑ ÏÛÉÂËÁ"
  162. #define ERR_SEARCHPATH_TRUNC "ðÕÔØ ÐÏÉÓËÁ ÏÂÒÅÚÁÎ"
  163. #define ERR_GETMODFN_TRUNC "GetModuleFileName() ÏÂÒÅÚÁÎ"
  164. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() ÎÅ ÐÏÌÕÞÉÌ ËÁÔÁÌÏÇ"
  165. #define ERR_DISK_FULL "äÉÓË ÐÏÌÏÎ"
  166. #define ERR_DIRECTORY_FULL "ëÁÔÁÌÏÇ ÐÏÌÏÎ"
  167. #define ERR_MACOS_GENERIC "MacOS ÓÏÏÂÝÉÌÁ ÏÛÉÂËÕ (%d)"
  168. #define ERR_OS2_GENERIC "OS/2 ÓÏÏÂÝÉÌÁ ÏÛÉÂËÕ (%d)"
  169. #define ERR_VOL_LOCKED_HW "ôÏÍ ÂÌÏËÉÒÏ×ÁÎ ÁÐÐÁÒÁÔÎÏ"
  170. #define ERR_VOL_LOCKED_SW "ôÏÍ ÂÌÏËÉÒÏ×ÁÎ ÐÒÏÇÒÁÍÍÎÏ"
  171. #define ERR_FILE_LOCKED "æÁÊÌ ÚÁÂÌÏËÉÒÏ×ÁÎ"
  172. #define ERR_FILE_OR_DIR_BUSY "æÁÊÌ/ËÁÔÁÌÏÇ ÚÁÎÑÔ"
  173. #define ERR_FILE_ALREADY_OPEN_W "æÁÊÌ ÕÖÅ ÏÔËÒÙÔ ÎÁ ÚÁÐÉÓØ"
  174. #define ERR_FILE_ALREADY_OPEN_R "æÁÊÌ ÕÖÅ ÏÔËÒÙÔ ÎÁ ÞÔÅÎÉÅ"
  175. #define ERR_INVALID_REFNUM "îÅ×ÅÒÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÓÓÙÌÏË"
  176. #define ERR_GETTING_FILE_POS "ïÛÉÂËÁ ÐÒÉ ÐÏÌÕÞÅÎÉÉ ÐÏÚÉÃÉÉ ÆÁÊÌÁ"
  177. #define ERR_VOLUME_OFFLINE "ôÏÍ ÏÔÓÏÅÄÉÎÅÎ"
  178. #define ERR_PERMISSION_DENIED "ïÔËÁÚÁÎÏ × ÒÁÚÒÅÛÅÎÉÉ"
  179. #define ERR_VOL_ALREADY_ONLINE "ôÏÍ ÕÖÅ ÐÏÄÓÏÅÄÉÎÅÎ"
  180. #define ERR_NO_SUCH_DRIVE "îÅÔ ÔÁËÏÇÏ ÄÉÓËÁ"
  181. #define ERR_NOT_MAC_DISK "îÅ ÄÉÓË Macintosh"
  182. #define ERR_VOL_EXTERNAL_FS "ôÏÍ ÐÒÉÎÁÄÌÅÖÉÔ ×ÎÅÛÎÅÊ ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÅ"
  183. #define ERR_PROBLEM_RENAME "ðÒÏÂÌÅÍÁ ÐÒÉ ÐÅÒÅÉÍÅÎÏ×ÁÎÉÉ"
  184. #define ERR_BAD_MASTER_BLOCK "ðÌÏÈÏÊ ÇÌÁ×ÎÙÊ ÂÌÏË ËÁÔÁÌÏÇÁ"
  185. #define ERR_CANT_MOVE_FORBIDDEN "ðÏÐÙÔËÁ ÐÅÒÅÍÅÓÔÉÔØ ÚÁÐÒÅÝÅÎÁ"
  186. #define ERR_WRONG_VOL_TYPE "îÅ×ÅÒÎÙÊ ÔÉÐ ÔÏÍÁ"
  187. #define ERR_SERVER_VOL_LOST "óÅÒ×ÅÒÎÙÊ ÔÏÍ ÂÙÌ ÏÔÓÏÅÄÉÎÅÎ"
  188. #define ERR_FILE_ID_NOT_FOUND "éÄÅÎÔÉÆÉËÁÔÏÒ ÆÁÊÌÁ ÎÅ ÎÁÊÄÅÎ"
  189. #define ERR_FILE_ID_EXISTS "éÄÅÎÔÉÆÉËÁÔÏÒ ÆÁÊÌÁ ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ"
  190. #define ERR_SERVER_NO_RESPOND "óÅÒ×ÅÒ ÎÅ ÏÔ×ÅÞÁÅÔ"
  191. #define ERR_USER_AUTH_FAILED "éÄÅÎÔÉÆÉËÁÃÉÑ ÐÏÌØÚÏ×ÁÔÅÌÑ ÎÅ ÕÄÁÌÁÓØ"
  192. #define ERR_PWORD_EXPIRED "ðÁÒÏÌØ ÎÁ ÓÅÒ×ÅÒÅ ÕÓÔÁÒÅÌ"
  193. #define ERR_ACCESS_DENIED "ïÔËÁÚÁÎÏ × ÄÏÓÔÕÐÅ"
  194. #define ERR_NOT_A_DOS_DISK "îÅ ÄÉÓË DOS"
  195. #define ERR_SHARING_VIOLATION "îÁÒÕÛÅÎÉÅ ÓÏ×ÍÅÓÔÎÏÇÏ ÄÏÓÔÕÐÁ"
  196. #define ERR_CANNOT_MAKE "îÅ ÍÏÇÕ ÓÏÂÒÁÔØ"
  197. #define ERR_DEV_IN_USE "õÓÔÒÏÊÓÔ×Ï ÕÖÅ ÉÓÐÏÌØÚÕÅÔÓÑ"
  198. #define ERR_OPEN_FAILED "ïÔËÒÙÔÉÅ ÎÅ ÕÄÁÌÏÓØ"
  199. #define ERR_PIPE_BUSY "ëÏÎ×ÅÊÅÒ ÚÁÎÑÔ"
  200. #define ERR_SHARING_BUF_EXCEEDED "òÁÚÄÅÌÑÅÍÙÊ ÂÕÆÅÒ ÐÅÒÅÐÏÌÎÅÎ"
  201. #define ERR_TOO_MANY_HANDLES "óÌÉÛËÏÍ ÍÎÏÇÏ ÏÔËÒÙÔÙÈ ÄÅÓËÒÉÐÔÏÒÏ×"
  202. #define ERR_SEEK_ERROR "ïÛÉÂËÁ ÐÏÚÉÃÉÏÎÉÒÏ×ÁÎÉÑ"
  203. #define ERR_DEL_CWD "ðÏÐÙÔËÁ ÕÄÁÌÉÔØ ÔÅËÕÝÉÊ ÒÁÂÏÞÉÊ ËÁÔÁÌÏÇ"
  204. #define ERR_WRITE_PROTECT_ERROR "ïÛÉÂËÁ ÚÁÝÉÔÙ ÚÁÐÉÓÉ"
  205. #define ERR_WRITE_FAULT "ïÛÉÂËÁ ÚÁÐÉÓÉ"
  206. #define ERR_LOCK_VIOLATION "îÁÒÕÛÅÎÉÅ ÂÌÏËÉÒÏ×ËÉ"
  207. #define ERR_GEN_FAILURE "ïÂÝÉÊ ÓÂÏÊ"
  208. #define ERR_UNCERTAIN_MEDIA "îÅÏÐÒÅÄÅÌÅÎÎÙÊ ÎÏÓÉÔÅÌØ"
  209. #define ERR_PROT_VIOLATION "îÁÒÕÛÅÎÉÅ ÚÁÝÉÔÙ"
  210. #define ERR_BROKEN_PIPE "óÌÏÍÁÎÎÙÊ ËÏÎ×ÅÊÅÒ"
  211. #elif (PHYSFS_LANG == PHYSFS_LANG_SPANISH)
  212. #define DIR_ARCHIVE_DESCRIPTION "No es un archivo, E/S directa al sistema de ficheros"
  213. #define GRP_ARCHIVE_DESCRIPTION "Formato Build engine Groupfile"
  214. #define ZIP_ARCHIVE_DESCRIPTION "Compatible con PkZip/WinZip/Info-Zip"
  215. #define ERR_IS_INITIALIZED "Ya estaba inicializado"
  216. #define ERR_NOT_INITIALIZED "No está inicializado"
  217. #define ERR_INVALID_ARGUMENT "Argumento inválido"
  218. #define ERR_FILES_STILL_OPEN "Archivos aún abiertos"
  219. #define ERR_NO_DIR_CREATE "Fallo al crear los directorios"
  220. #define ERR_OUT_OF_MEMORY "Memoria agotada"
  221. #define ERR_NOT_IN_SEARCH_PATH "No existe tal entrada en la ruta de búsqueda"
  222. #define ERR_NOT_SUPPORTED "Operación no soportada"
  223. #define ERR_UNSUPPORTED_ARCHIVE "Tipo de archivo no soportado"
  224. #define ERR_NOT_A_HANDLE "No es un manejador de ficheo (file handle)"
  225. #define ERR_INSECURE_FNAME "Nombre de archivo inseguro"
  226. #define ERR_SYMLINK_DISALLOWED "Los enlaces simbólicos están desactivados"
  227. #define ERR_NO_WRITE_DIR "No has configurado un directorio de escritura"
  228. #define ERR_NO_SUCH_FILE "Archivo no encontrado"
  229. #define ERR_NO_SUCH_PATH "Ruta no encontrada"
  230. #define ERR_NO_SUCH_VOLUME "Volumen no encontrado"
  231. #define ERR_PAST_EOF "Te pasaste del final del archivo"
  232. #define ERR_ARC_IS_READ_ONLY "El archivo es de sólo lectura"
  233. #define ERR_IO_ERROR "Error E/S"
  234. #define ERR_CANT_SET_WRITE_DIR "No puedo configurar el directorio de escritura"
  235. #define ERR_SYMLINK_LOOP "Bucle infnito de enlaces simbólicos"
  236. #define ERR_COMPRESSION "Error de (des)compresión"
  237. #define ERR_NOT_IMPLEMENTED "No implementado"
  238. #define ERR_OS_ERROR "El sistema operativo ha devuelto un error"
  239. #define ERR_FILE_EXISTS "El archivo ya existe"
  240. #define ERR_NOT_A_FILE "No es un archivo"
  241. #define ERR_NOT_A_DIR "No es un directorio"
  242. #define ERR_NOT_AN_ARCHIVE "No es un archivo"
  243. #define ERR_CORRUPTED "Archivo corrupto"
  244. #define ERR_SEEK_OUT_OF_RANGE "Búsqueda fuera de rango"
  245. #define ERR_BAD_FILENAME "Nombre de archivo incorrecto"
  246. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS ha hecho una llamada incorrecta al sistema"
  247. #define ERR_ARGV0_IS_NULL "argv0 es NULL"
  248. #define ERR_ZLIB_NEED_DICT "zlib: necesito diccionario"
  249. #define ERR_ZLIB_DATA_ERROR "zlib: error de datos"
  250. #define ERR_ZLIB_MEMORY_ERROR "zlib: error de memoria"
  251. #define ERR_ZLIB_BUFFER_ERROR "zlib: error de buffer"
  252. #define ERR_ZLIB_VERSION_ERROR "zlib: error de versión"
  253. #define ERR_ZLIB_UNKNOWN_ERROR "zlib: error desconocido"
  254. #define ERR_SEARCHPATH_TRUNC "La ruta de búsqueda ha sido truncada"
  255. #define ERR_GETMODFN_TRUNC "GetModuleFileName() ha sido truncado"
  256. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() no tenia directorio"
  257. #define ERR_DISK_FULL "El disco está lleno"
  258. #define ERR_DIRECTORY_FULL "El directorio está lleno"
  259. #define ERR_MACOS_GENERIC "MacOS ha devuelto un error (%d)"
  260. #define ERR_OS2_GENERIC "OS/2 ha devuelto un error (%d)"
  261. #define ERR_VOL_LOCKED_HW "El volumen está bloqueado por el hardware"
  262. #define ERR_VOL_LOCKED_SW "El volumen está bloqueado por el software"
  263. #define ERR_FILE_LOCKED "El archivo está bloqueado"
  264. #define ERR_FILE_OR_DIR_BUSY "Fichero o directorio ocupados"
  265. #define ERR_FILE_ALREADY_OPEN_W "Fichero ya abierto para escritura"
  266. #define ERR_FILE_ALREADY_OPEN_R "Fichero ya abierto para lectura"
  267. #define ERR_INVALID_REFNUM "El número de referencia no es válido"
  268. #define ERR_GETTING_FILE_POS "Error al tomar la posición del fichero"
  269. #define ERR_VOLUME_OFFLINE "El volumen está desconectado"
  270. #define ERR_PERMISSION_DENIED "Permiso denegado"
  271. #define ERR_VOL_ALREADY_ONLINE "El volumen ya estaba conectado"
  272. #define ERR_NO_SUCH_DRIVE "No existe tal unidad"
  273. #define ERR_NOT_MAC_DISK "No es un disco Macintosh"
  274. #define ERR_VOL_EXTERNAL_FS "El volumen pertence a un sistema de ficheros externo"
  275. #define ERR_PROBLEM_RENAME "Problemas al renombrar"
  276. #define ERR_BAD_MASTER_BLOCK "Bloque maestro de directorios incorrecto"
  277. #define ERR_CANT_MOVE_FORBIDDEN "Intento de mover forbidden"
  278. #define ERR_WRONG_VOL_TYPE "Tipo de volumen incorrecto"
  279. #define ERR_SERVER_VOL_LOST "El servidor de volúmenes ha sido desconectado"
  280. #define ERR_FILE_ID_NOT_FOUND "Identificador de archivo no encontrado"
  281. #define ERR_FILE_ID_EXISTS "El identificador de archivo ya existe"
  282. #define ERR_SERVER_NO_RESPOND "El servidor no responde"
  283. #define ERR_USER_AUTH_FAILED "Fallo al autentificar el usuario"
  284. #define ERR_PWORD_EXPIRED "La Password en el servidor ha caducado"
  285. #define ERR_ACCESS_DENIED "Acceso denegado"
  286. #define ERR_NOT_A_DOS_DISK "No es un disco de DOS"
  287. #define ERR_SHARING_VIOLATION "Violación al compartir"
  288. #define ERR_CANNOT_MAKE "No puedo hacer make"
  289. #define ERR_DEV_IN_USE "El dispositivo ya estaba en uso"
  290. #define ERR_OPEN_FAILED "Fallo al abrir"
  291. #define ERR_PIPE_BUSY "Tubería ocupada"
  292. #define ERR_SHARING_BUF_EXCEEDED "Buffer de compartición sobrepasado"
  293. #define ERR_TOO_MANY_HANDLES "Demasiados manejadores (handles)"
  294. #define ERR_SEEK_ERROR "Error de búsqueda"
  295. #define ERR_DEL_CWD "Intentando borrar el directorio de trabajo actual"
  296. #define ERR_WRITE_PROTECT_ERROR "Error de protección contra escritura"
  297. #define ERR_WRITE_FAULT "Fallo al escribir"
  298. #define ERR_LOCK_VIOLATION "Violación del bloqueo"
  299. #define ERR_GEN_FAILURE "Fallo general"
  300. #define ERR_UNCERTAIN_MEDIA "Medio incierto"
  301. #define ERR_PROT_VIOLATION "Violación de la protección"
  302. #define ERR_BROKEN_PIPE "Tubería rota"
  303. #elif (PHYSFS_LANG == PHYSFS_LANG_FRENCH)
  304. #define DIR_ARCHIVE_DESCRIPTION "Pas d'archive, E/S directes sur système de fichiers"
  305. #define GRP_ARCHIVE_DESCRIPTION "Format Groupfile du moteur Build"
  306. #define ZIP_ARCHIVE_DESCRIPTION "Compatible PkZip/WinZip/Info-Zip"
  307. #define ERR_IS_INITIALIZED "Déjà initialisé"
  308. #define ERR_NOT_INITIALIZED "Non initialisé"
  309. #define ERR_INVALID_ARGUMENT "Argument invalide"
  310. #define ERR_FILES_STILL_OPEN "Fichiers encore ouverts"
  311. #define ERR_NO_DIR_CREATE "Echec de la création de répertoires"
  312. #define ERR_OUT_OF_MEMORY "A court de mémoire"
  313. #define ERR_NOT_IN_SEARCH_PATH "Aucune entrée dans le chemin de recherche"
  314. #define ERR_NOT_SUPPORTED "Opération non supportée"
  315. #define ERR_UNSUPPORTED_ARCHIVE "Type d'archive non supportée"
  316. #define ERR_NOT_A_HANDLE "Pas un descripteur de fichier"
  317. #define ERR_INSECURE_FNAME "Nom de fichier dangereux"
  318. #define ERR_SYMLINK_DISALLOWED "Les liens symboliques sont désactivés"
  319. #define ERR_NO_WRITE_DIR "Le répertoire d'écriture n'est pas spécifié"
  320. #define ERR_NO_SUCH_FILE "Fichier non trouvé"
  321. #define ERR_NO_SUCH_PATH "Chemin non trouvé"
  322. #define ERR_NO_SUCH_VOLUME "Volume non trouvé"
  323. #define ERR_PAST_EOF "Au-delà de la fin du fichier"
  324. #define ERR_ARC_IS_READ_ONLY "L'archive est en lecture seule"
  325. #define ERR_IO_ERROR "Erreur E/S"
  326. #define ERR_CANT_SET_WRITE_DIR "Ne peut utiliser le répertoire d'écriture"
  327. #define ERR_SYMLINK_LOOP "Boucle infinie dans les liens symboliques"
  328. #define ERR_COMPRESSION "Erreur de (dé)compression"
  329. #define ERR_NOT_IMPLEMENTED "Non implémenté"
  330. #define ERR_OS_ERROR "Erreur rapportée par le système d'exploitation"
  331. #define ERR_FILE_EXISTS "Le fichier existe déjà"
  332. #define ERR_NOT_A_FILE "Pas un fichier"
  333. #define ERR_NOT_A_DIR "Pas un répertoire"
  334. #define ERR_NOT_AN_ARCHIVE "Pas une archive"
  335. #define ERR_CORRUPTED "Archive corrompue"
  336. #define ERR_SEEK_OUT_OF_RANGE "Pointeur de fichier hors de portée"
  337. #define ERR_BAD_FILENAME "Mauvais nom de fichier"
  338. #define ERR_PHYSFS_BAD_OS_CALL "(BOGUE) PhysicsFS a fait un mauvais appel système, le salaud"
  339. #define ERR_ARGV0_IS_NULL "argv0 est NULL"
  340. #define ERR_ZLIB_NEED_DICT "zlib: a besoin du dico"
  341. #define ERR_ZLIB_DATA_ERROR "zlib: erreur de données"
  342. #define ERR_ZLIB_MEMORY_ERROR "zlib: erreur mémoire"
  343. #define ERR_ZLIB_BUFFER_ERROR "zlib: erreur tampon"
  344. #define ERR_ZLIB_VERSION_ERROR "zlib: erreur de version"
  345. #define ERR_ZLIB_UNKNOWN_ERROR "zlib: erreur inconnue"
  346. #define ERR_SEARCHPATH_TRUNC "Le chemin de recherche a été tronqué"
  347. #define ERR_GETMODFN_TRUNC "GetModuleFileName() a été tronqué"
  348. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() n'a pas de répertoire"
  349. #define ERR_DISK_FULL "Disque plein"
  350. #define ERR_DIRECTORY_FULL "Répertoire plein"
  351. #define ERR_MACOS_GENERIC "Erreur rapportée par MacOS (%d)"
  352. #define ERR_OS2_GENERIC "Erreur rapportée par OS/2 (%d)"
  353. #define ERR_VOL_LOCKED_HW "Le volume est verrouillé matériellement"
  354. #define ERR_VOL_LOCKED_SW "Le volume est verrouillé par logiciel"
  355. #define ERR_FILE_LOCKED "Fichier verrouillé"
  356. #define ERR_FILE_OR_DIR_BUSY "Fichier/répertoire occupé"
  357. #define ERR_FILE_ALREADY_OPEN_W "Fichier déjà ouvert en écriture"
  358. #define ERR_FILE_ALREADY_OPEN_R "Fichier déjà ouvert en lecture"
  359. #define ERR_INVALID_REFNUM "Numéro de référence invalide"
  360. #define ERR_GETTING_FILE_POS "Erreur lors de l'obtention de la position du pointeur de fichier"
  361. #define ERR_VOLUME_OFFLINE "Le volume n'est pas en ligne"
  362. #define ERR_PERMISSION_DENIED "Permission refusée"
  363. #define ERR_VOL_ALREADY_ONLINE "Volumé déjà en ligne"
  364. #define ERR_NO_SUCH_DRIVE "Lecteur inexistant"
  365. #define ERR_NOT_MAC_DISK "Pas un disque Macintosh"
  366. #define ERR_VOL_EXTERNAL_FS "Le volume appartient à un système de fichiers externe"
  367. #define ERR_PROBLEM_RENAME "Problème lors du renommage"
  368. #define ERR_BAD_MASTER_BLOCK "Mauvais block maitre de répertoire"
  369. #define ERR_CANT_MOVE_FORBIDDEN "Essai de déplacement interdit"
  370. #define ERR_WRONG_VOL_TYPE "Mauvais type de volume"
  371. #define ERR_SERVER_VOL_LOST "Le volume serveur a été déconnecté"
  372. #define ERR_FILE_ID_NOT_FOUND "Identificateur de fichier non trouvé"
  373. #define ERR_FILE_ID_EXISTS "Identificateur de fichier existe déjà"
  374. #define ERR_SERVER_NO_RESPOND "Le serveur ne répond pas"
  375. #define ERR_USER_AUTH_FAILED "Authentification de l'utilisateur échouée"
  376. #define ERR_PWORD_EXPIRED "Le mot de passe a expiré sur le serveur"
  377. #define ERR_ACCESS_DENIED "Accès refusé"
  378. #define ERR_NOT_A_DOS_DISK "Pas un disque DOS"
  379. #define ERR_SHARING_VIOLATION "Violation de partage"
  380. #define ERR_CANNOT_MAKE "Ne peut faire"
  381. #define ERR_DEV_IN_USE "Périphérique déjà en utilisation"
  382. #define ERR_OPEN_FAILED "Ouverture échouée"
  383. #define ERR_PIPE_BUSY "Le tube est occupé"
  384. #define ERR_SHARING_BUF_EXCEEDED "Tampon de partage dépassé"
  385. #define ERR_TOO_MANY_HANDLES "Trop de descripteurs ouverts"
  386. #define ERR_SEEK_ERROR "Erreur de positionement"
  387. #define ERR_DEL_CWD "Essai de supprimer le répertoire courant"
  388. #define ERR_WRITE_PROTECT_ERROR "Erreur de protection en écriture"
  389. #define ERR_WRITE_FAULT "Erreur d'écriture"
  390. #define ERR_LOCK_VIOLATION "Violation de verrou"
  391. #define ERR_GEN_FAILURE "Echec général"
  392. #define ERR_UNCERTAIN_MEDIA "Média incertain"
  393. #define ERR_PROT_VIOLATION "Violation de protection"
  394. #define ERR_BROKEN_PIPE "Tube cassé"
  395. #else
  396. #error Please define PHYSFS_LANG.
  397. #endif
  398. /* end LANG section. */
  399. struct __PHYSFS_DIRHANDLE__;
  400. struct __PHYSFS_FILEFUNCTIONS__;
  401. typedef struct __PHYSFS_LINKEDSTRINGLIST__
  402. {
  403. char *str;
  404. struct __PHYSFS_LINKEDSTRINGLIST__ *next;
  405. } LinkedStringList;
  406. typedef struct __PHYSFS_FILEHANDLE__
  407. {
  408. /*
  409. * This is reserved for the driver to store information.
  410. */
  411. void *opaque;
  412. /*
  413. * This should be the DirHandle that created this FileHandle.
  414. */
  415. const struct __PHYSFS_DIRHANDLE__ *dirHandle;
  416. /*
  417. * Pointer to the file i/o functions for this filehandle.
  418. */
  419. const struct __PHYSFS_FILEFUNCTIONS__ *funcs;
  420. } FileHandle;
  421. typedef struct __PHYSFS_FILEFUNCTIONS__
  422. {
  423. /*
  424. * Read more from the file.
  425. * Returns number of objects of (objSize) bytes read from file, -1
  426. * if complete failure.
  427. * On failure, call __PHYSFS_setError().
  428. */
  429. PHYSFS_sint64 (*read)(FileHandle *handle, void *buffer,
  430. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
  431. /*
  432. * Write more to the file. Archives don't have to implement this.
  433. * (Set it to NULL if not implemented).
  434. * Returns number of objects of (objSize) bytes written to file, -1
  435. * if complete failure.
  436. * On failure, call __PHYSFS_setError().
  437. */
  438. PHYSFS_sint64 (*write)(FileHandle *handle, const void *buffer,
  439. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
  440. /*
  441. * Returns non-zero if at end of file.
  442. */
  443. int (*eof)(FileHandle *handle);
  444. /*
  445. * Returns byte offset from start of file.
  446. */
  447. PHYSFS_sint64 (*tell)(FileHandle *handle);
  448. /*
  449. * Move read/write pointer to byte offset from start of file.
  450. * Returns non-zero on success, zero on error.
  451. * On failure, call __PHYSFS_setError().
  452. */
  453. int (*seek)(FileHandle *handle, PHYSFS_uint64 offset);
  454. /*
  455. * Return number of bytes available in the file, or -1 if you
  456. * aren't able to determine.
  457. * On failure, call __PHYSFS_setError().
  458. */
  459. PHYSFS_sint64 (*fileLength)(FileHandle *handle);
  460. /*
  461. * Close the file, and free the FileHandle structure (including "opaque").
  462. * returns non-zero on success, zero if can't close file.
  463. * On failure, call __PHYSFS_setError().
  464. */
  465. int (*fileClose)(FileHandle *handle);
  466. } FileFunctions;
  467. typedef struct __PHYSFS_DIRHANDLE__
  468. {
  469. /*
  470. * This is reserved for the driver to store information.
  471. */
  472. void *opaque;
  473. /*
  474. * Pointer to the directory i/o functions for this handle.
  475. */
  476. const struct __PHYSFS_DIRFUNCTIONS__ *funcs;
  477. } DirHandle;
  478. /*
  479. * Symlinks should always be followed; PhysicsFS will use
  480. * DirFunctions->isSymLink() and make a judgement on whether to
  481. * continue to call other methods based on that.
  482. */
  483. typedef struct __PHYSFS_DIRFUNCTIONS__
  484. {
  485. const PHYSFS_ArchiveInfo *info;
  486. /*
  487. * Returns non-zero if (filename) is a valid archive that this
  488. * driver can handle. This filename is in platform-dependent
  489. * notation. forWriting is non-zero if this is to be used for
  490. * the write directory, and zero if this is to be used for an
  491. * element of the search path.
  492. */
  493. int (*isArchive)(const char *filename, int forWriting);
  494. /*
  495. * Return a DirHandle for dir/archive (name).
  496. * This filename is in platform-dependent notation.
  497. * forWriting is non-zero if this is to be used for
  498. * the write directory, and zero if this is to be used for an
  499. * element of the search path.
  500. * Returns NULL on failure, and calls __PHYSFS_setError().
  501. */
  502. DirHandle *(*openArchive)(const char *name, int forWriting);
  503. /*
  504. * Returns a list of all files in dirname. Each element of this list
  505. * (and its "str" field) will be deallocated with the system's free()
  506. * function by the caller, so be sure to explicitly malloc() each
  507. * chunk. Omit symlinks if (omitSymLinks) is non-zero.
  508. * If you have a memory failure, return as much as you can.
  509. * This dirname is in platform-independent notation.
  510. */
  511. LinkedStringList *(*enumerateFiles)(DirHandle *r,
  512. const char *dirname,
  513. int omitSymLinks);
  514. /*
  515. * Returns non-zero if filename can be opened for reading.
  516. * This filename is in platform-independent notation.
  517. */
  518. int (*exists)(DirHandle *r, const char *name);
  519. /*
  520. * Returns non-zero if filename is really a directory.
  521. * This filename is in platform-independent notation.
  522. * Symlinks should be followed; if what the symlink points
  523. * to is missing, or isn't a directory, then the retval is zero.
  524. */
  525. int (*isDirectory)(DirHandle *r, const char *name);
  526. /*
  527. * Returns non-zero if filename is really a symlink.
  528. * This filename is in platform-independent notation.
  529. */
  530. int (*isSymLink)(DirHandle *r, const char *name);
  531. /*
  532. * Retrieve the last modification time (mtime) of a file.
  533. * Returns -1 on failure, or the file's mtime in seconds since
  534. * the epoch (Jan 1, 1970) on success.
  535. * This filename is in platform-independent notation.
  536. */
  537. PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *filename);
  538. /*
  539. * Open file for reading, and return a FileHandle.
  540. * This filename is in platform-independent notation.
  541. * If you can't handle multiple opens of the same file,
  542. * you can opt to fail for the second call.
  543. * Fail if the file does not exist.
  544. * Returns NULL on failure, and calls __PHYSFS_setError().
  545. */
  546. FileHandle *(*openRead)(DirHandle *r, const char *filename);
  547. /*
  548. * Open file for writing, and return a FileHandle.
  549. * If the file does not exist, it should be created. If it exists,
  550. * it should be truncated to zero bytes. The writing
  551. * offset should be the start of the file.
  552. * This filename is in platform-independent notation.
  553. * This method may be NULL.
  554. * If you can't handle multiple opens of the same file,
  555. * you can opt to fail for the second call.
  556. * Returns NULL on failure, and calls __PHYSFS_setError().
  557. */
  558. FileHandle *(*openWrite)(DirHandle *r, const char *filename);
  559. /*
  560. * Open file for appending, and return a FileHandle.
  561. * If the file does not exist, it should be created. The writing
  562. * offset should be the end of the file.
  563. * This filename is in platform-independent notation.
  564. * This method may be NULL.
  565. * If you can't handle multiple opens of the same file,
  566. * you can opt to fail for the second call.
  567. * Returns NULL on failure, and calls __PHYSFS_setError().
  568. */
  569. FileHandle *(*openAppend)(DirHandle *r, const char *filename);
  570. /*
  571. * Delete a file in the archive/directory.
  572. * Return non-zero on success, zero on failure.
  573. * This filename is in platform-independent notation.
  574. * This method may be NULL.
  575. * On failure, call __PHYSFS_setError().
  576. */
  577. int (*remove)(DirHandle *r, const char *filename);
  578. /*
  579. * Create a directory in the archive/directory.
  580. * If the application is trying to make multiple dirs, PhysicsFS
  581. * will split them up into multiple calls before passing them to
  582. * your driver.
  583. * Return non-zero on success, zero on failure.
  584. * This filename is in platform-independent notation.
  585. * This method may be NULL.
  586. * On failure, call __PHYSFS_setError().
  587. */
  588. int (*mkdir)(DirHandle *r, const char *filename);
  589. /*
  590. * Close directories/archives, and free the handle, including
  591. * the "opaque" entry. This should assume that it won't be called if
  592. * there are still files open from this DirHandle.
  593. */
  594. void (*dirClose)(DirHandle *r);
  595. } DirFunctions;
  596. /*
  597. * Call this to set the message returned by PHYSFS_getLastError().
  598. * Please only use the ERR_* constants above, or add new constants to the
  599. * above group, but I want these all in one place.
  600. *
  601. * Calling this with a NULL argument is a safe no-op.
  602. */
  603. void __PHYSFS_setError(const char *err);
  604. /*
  605. * Convert (dirName) to platform-dependent notation, then prepend (prepend)
  606. * and append (append) to the converted string.
  607. *
  608. * So, on Win32, calling:
  609. * __PHYSFS_convertToDependent("C:\", "my/files", NULL);
  610. * ...will return the string "C:\my\files".
  611. *
  612. * This is a convenience function; you might want to hack something out that
  613. * is less generic (and therefore more efficient).
  614. *
  615. * Be sure to free() the return value when done with it.
  616. */
  617. char *__PHYSFS_convertToDependent(const char *prepend,
  618. const char *dirName,
  619. const char *append);
  620. /*
  621. * Verify that (fname) (in platform-independent notation), in relation
  622. * to (h) is secure. That means that each element of fname is checked
  623. * for symlinks (if they aren't permitted). Also, elements such as
  624. * ".", "..", or ":" are flagged.
  625. *
  626. * Returns non-zero if string is safe, zero if there's a security issue.
  627. * PHYSFS_getLastError() will specify what was wrong.
  628. */
  629. int __PHYSFS_verifySecurity(DirHandle *h, const char *fname);
  630. /*
  631. * Use this to build the list that your enumerate function should return.
  632. * See zip.c for an example of proper use.
  633. */
  634. LinkedStringList *__PHYSFS_addToLinkedStringList(LinkedStringList *retval,
  635. LinkedStringList **prev,
  636. const char *str,
  637. PHYSFS_sint32 len);
  638. /* These get used all over for lessening code clutter. */
  639. #define BAIL_MACRO(e, r) { __PHYSFS_setError(e); return r; }
  640. #define BAIL_IF_MACRO(c, e, r) if (c) { __PHYSFS_setError(e); return r; }
  641. #define BAIL_MACRO_MUTEX(e, m, r) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; }
  642. #define BAIL_IF_MACRO_MUTEX(c, e, m, r) if (c) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; }
  643. /*--------------------------------------------------------------------------*/
  644. /*--------------------------------------------------------------------------*/
  645. /*------------ ----------------*/
  646. /*------------ You MUST implement the following functions ----------------*/
  647. /*------------ if porting to a new platform. ----------------*/
  648. /*------------ (see platform/unix.c for an example) ----------------*/
  649. /*------------ ----------------*/
  650. /*--------------------------------------------------------------------------*/
  651. /*--------------------------------------------------------------------------*/
  652. /*
  653. * The dir separator; "/" on unix, "\\" on win32, ":" on MacOS, etc...
  654. * Obviously, this isn't a function, but it IS a null-terminated string.
  655. */
  656. extern const char *__PHYSFS_platformDirSeparator;
  657. /*
  658. * Initialize the platform. This is called when PHYSFS_init() is called from
  659. * the application. You can use this to (for example) determine what version
  660. * of Windows you're running.
  661. *
  662. * Return zero if there was a catastrophic failure (which prevents you from
  663. * functioning at all), and non-zero otherwise.
  664. */
  665. int __PHYSFS_platformInit(void);
  666. /*
  667. * Deinitialize the platform. This is called when PHYSFS_deinit() is called
  668. * from the application. You can use this to clean up anything you've
  669. * allocated in your platform driver.
  670. *
  671. * Return zero if there was a catastrophic failure (which prevents you from
  672. * functioning at all), and non-zero otherwise.
  673. */
  674. int __PHYSFS_platformDeinit(void);
  675. /*
  676. * Open a file for reading. (filename) is in platform-dependent notation. The
  677. * file pointer should be positioned on the first byte of the file.
  678. *
  679. * The return value will be some platform-specific datatype that is opaque to
  680. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32.
  681. *
  682. * The same file can be opened for read multiple times, and each should have
  683. * a unique file handle; this is frequently employed to prevent race
  684. * conditions in the archivers.
  685. *
  686. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  687. */
  688. void *__PHYSFS_platformOpenRead(const char *filename);
  689. /*
  690. * Open a file for writing. (filename) is in platform-dependent notation. If
  691. * the file exists, it should be truncated to zero bytes, and if it doesn't
  692. * exist, it should be created as a zero-byte file. The file pointer should
  693. * be positioned on the first byte of the file.
  694. *
  695. * The return value will be some platform-specific datatype that is opaque to
  696. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32,
  697. * etc.
  698. *
  699. * Opening a file for write multiple times has undefined results.
  700. *
  701. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  702. */
  703. void *__PHYSFS_platformOpenWrite(const char *filename);
  704. /*
  705. * Open a file for appending. (filename) is in platform-dependent notation. If
  706. * the file exists, the file pointer should be place just past the end of the
  707. * file, so that the first write will be one byte after the current end of
  708. * the file. If the file doesn't exist, it should be created as a zero-byte
  709. * file. The file pointer should be positioned on the first byte of the file.
  710. *
  711. * The return value will be some platform-specific datatype that is opaque to
  712. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32,
  713. * etc.
  714. *
  715. * Opening a file for append multiple times has undefined results.
  716. *
  717. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  718. */
  719. void *__PHYSFS_platformOpenAppend(const char *filename);
  720. /*
  721. * Read more data from a platform-specific file handle. (opaque) should be
  722. * cast to whatever data type your platform uses. Read a maximum of (count)
  723. * objects of (size) 8-bit bytes to the area pointed to by (buffer). If there
  724. * isn't enough data available, return the number of full objects read, and
  725. * position the file pointer at the start of the first incomplete object.
  726. * On success, return (count) and position the file pointer one byte past
  727. * the end of the last read object. Return (-1) if there is a catastrophic
  728. * error, and call __PHYSFS_setError() to describe the problem; the file
  729. * pointer should not move in such a case.
  730. */
  731. PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
  732. PHYSFS_uint32 size, PHYSFS_uint32 count);
  733. /*
  734. * Write more data to a platform-specific file handle. (opaque) should be
  735. * cast to whatever data type your platform uses. Write a maximum of (count)
  736. * objects of (size) 8-bit bytes from the area pointed to by (buffer). If
  737. * there isn't enough data available, return the number of full objects
  738. * written, and position the file pointer at the start of the first
  739. * incomplete object. Return (-1) if there is a catastrophic error, and call
  740. * __PHYSFS_setError() to describe the problem; the file pointer should not
  741. * move in such a case.
  742. */
  743. PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
  744. PHYSFS_uint32 size, PHYSFS_uint32 count);
  745. /*
  746. * Set the file pointer to a new position. (opaque) should be cast to
  747. * whatever data type your platform uses. (pos) specifies the number
  748. * of 8-bit bytes to seek to from the start of the file. Seeking past the
  749. * end of the file is an error condition, and you should check for it.
  750. *
  751. * Not all file types can seek; this is to be expected by the caller.
  752. *
  753. * On error, call __PHYSFS_setError() and return zero. On success, return
  754. * a non-zero value.
  755. */
  756. int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos);
  757. /*
  758. * Get the file pointer's position, in an 8-bit byte offset from the start of
  759. * the file. (opaque) should be cast to whatever data type your platform
  760. * uses.
  761. *
  762. * Not all file types can "tell"; this is to be expected by the caller.
  763. *
  764. * On error, call __PHYSFS_setError() and return zero. On success, return
  765. * a non-zero value.
  766. */
  767. PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);
  768. /*
  769. * Determine the current size of a file, in 8-bit bytes, from an open file.
  770. *
  771. * The caller expects that this information may not be available for all
  772. * file types on all platforms.
  773. *
  774. * Return -1 if you can't do it, and call __PHYSFS_setError(). Otherwise,
  775. * return the file length in 8-bit bytes.
  776. */
  777. PHYSFS_sint64 __PHYSFS_platformFileLength(void *handle);
  778. /*
  779. * Determine if a file is at EOF. (opaque) should be cast to whatever data
  780. * type your platform uses.
  781. *
  782. * The caller expects that there was a short read before calling this.
  783. *
  784. * Return non-zero if EOF, zero if it is _not_ EOF.
  785. */
  786. int __PHYSFS_platformEOF(void *opaque);
  787. /*
  788. * Flush any pending writes to disk. (opaque) should be cast to whatever data
  789. * type your platform uses. Be sure to check for errors; the caller expects
  790. * that this function can fail if there was a flushing error, etc.
  791. *
  792. * Return zero on failure, non-zero on success.
  793. */
  794. int __PHYSFS_platformFlush(void *opaque);
  795. /*
  796. * Flush and close a file. (opaque) should be cast to whatever data type
  797. * your platform uses. Be sure to check for errors when closing; the
  798. * caller expects that this function can fail if there was a flushing
  799. * error, etc.
  800. *
  801. * You should clean up all resources associated with (opaque).
  802. *
  803. * Return zero on failure, non-zero on success.
  804. */
  805. int __PHYSFS_platformClose(void *opaque);
  806. /*
  807. * Platform implementation of PHYSFS_getCdRomDirs()...
  808. * See physfs.h. The retval should be freeable via PHYSFS_freeList().
  809. */
  810. char **__PHYSFS_platformDetectAvailableCDs(void);
  811. /*
  812. * Calculate the base dir, if your platform needs special consideration.
  813. * Just return NULL if the standard routines will suffice. (see
  814. * calculateBaseDir() in physfs.c ...)
  815. * Caller will free() the retval if it's not NULL.
  816. */
  817. char *__PHYSFS_platformCalcBaseDir(const char *argv0);
  818. /*
  819. * Get the platform-specific user name.
  820. * Caller will free() the retval if it's not NULL. If it's NULL, the username
  821. * will default to "default".
  822. */
  823. char *__PHYSFS_platformGetUserName(void);
  824. /*
  825. * Get the platform-specific user dir.
  826. * Caller will free() the retval if it's not NULL. If it's NULL, the userdir
  827. * will default to basedir/username.
  828. */
  829. char *__PHYSFS_platformGetUserDir(void);
  830. /*
  831. * Return a number that uniquely identifies the current thread.
  832. * On a platform without threading, (1) will suffice. These numbers are
  833. * arbitrary; the only requirement is that no two threads have the same
  834. * number.
  835. */
  836. PHYSFS_uint64 __PHYSFS_platformGetThreadID(void);
  837. /*
  838. * This is a pass-through to whatever stricmp() is called on your platform.
  839. */
  840. int __PHYSFS_platformStricmp(const char *str1, const char *str2);
  841. /*
  842. * Return non-zero if filename (in platform-dependent notation) exists.
  843. * Symlinks should be followed; if what the symlink points to is missing,
  844. * then the retval is false.
  845. */
  846. int __PHYSFS_platformExists(const char *fname);
  847. /*
  848. * Return the last modified time (in seconds since the epoch) of a file.
  849. * Returns -1 on failure. (fname) is in platform-dependent notation.
  850. * Symlinks should be followed; if what the symlink points to is missing,
  851. * then the retval is -1.
  852. */
  853. PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname);
  854. /*
  855. * Return non-zero if filename (in platform-dependent notation) is a symlink.
  856. */
  857. int __PHYSFS_platformIsSymLink(const char *fname);
  858. /*
  859. * Return non-zero if filename (in platform-dependent notation) is a symlink.
  860. * Symlinks should be followed; if what the symlink points to is missing,
  861. * or isn't a directory, then the retval is false.
  862. */
  863. int __PHYSFS_platformIsDirectory(const char *fname);
  864. /*
  865. * Convert (dirName) to platform-dependent notation, then prepend (prepend)
  866. * and append (append) to the converted string.
  867. *
  868. * So, on Win32, calling:
  869. * __PHYSFS_platformCvtToDependent("C:\", "my/files", NULL);
  870. * ...will return the string "C:\my\files".
  871. *
  872. * This can be implemented in a platform-specific manner, so you can get
  873. * get a speed boost that the default implementation can't, since
  874. * you can make assumptions about the size of strings, etc..
  875. *
  876. * Platforms that choose not to implement this may just call
  877. * __PHYSFS_convertToDependent() as a passthrough, which may fit the bill
  878. * already.
  879. *
  880. * Be sure to free() the return value when done with it.
  881. */
  882. char *__PHYSFS_platformCvtToDependent(const char *prepend,
  883. const char *dirName,
  884. const char *append);
  885. /*
  886. * Make the current thread give up a timeslice. This is called in a loop
  887. * while waiting for various external forces to get back to us.
  888. */
  889. void __PHYSFS_platformTimeslice(void);
  890. /*
  891. * Enumerate a directory of files. This follows the rules for the
  892. * DirFunctions->enumerateFiles() method (see above), except that the
  893. * (dirName) that is passed to this function is converted to
  894. * platform-DEPENDENT notation by the caller. The DirFunctions version
  895. * uses platform-independent notation. Note that ".", "..", and other
  896. * metaentries should always be ignored.
  897. */
  898. LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
  899. int omitSymLinks);
  900. /*
  901. * Get the current working directory. The return value should be an
  902. * absolute path in platform-dependent notation. The caller will deallocate
  903. * the return value with the standard C runtime free() function when it
  904. * is done with it.
  905. * On error, return NULL and set the error message.
  906. */
  907. char *__PHYSFS_platformCurrentDir(void);
  908. /*
  909. * Get the real physical path to a file. (path) is specified in
  910. * platform-dependent notation, as should your return value be.
  911. * All relative paths should be removed, leaving you with an absolute
  912. * path. Symlinks should be resolved, too, so that the returned value is
  913. * the most direct path to a file.
  914. * The return value will be deallocated with the standard C runtime free()
  915. * function when the caller is done with it.
  916. * On error, return NULL and set the error message.
  917. */
  918. char *__PHYSFS_platformRealPath(const char *path);
  919. /*
  920. * Make a directory in the actual filesystem. (path) is specified in
  921. * platform-dependent notation. On error, return zero and set the error
  922. * message. Return non-zero on success.
  923. */
  924. int __PHYSFS_platformMkDir(const char *path);
  925. /*
  926. * Remove a file or directory entry in the actual filesystem. (path) is
  927. * specified in platform-dependent notation. Note that this deletes files
  928. * _and_ directories, so you might need to do some determination.
  929. * Non-empty directories should report an error and not delete themselves
  930. * or their contents.
  931. *
  932. * Deleting a symlink should remove the link, not what it points to.
  933. *
  934. * On error, return zero and set the error message. Return non-zero on success.
  935. */
  936. int __PHYSFS_platformDelete(const char *path);
  937. /*
  938. * Create a platform-specific mutex. This can be whatever datatype your
  939. * platform uses for mutexes, but it is cast to a (void *) for abstractness.
  940. *
  941. * Return (NULL) if you couldn't create one. Systems without threads can
  942. * return any arbitrary non-NULL value.
  943. */
  944. void *__PHYSFS_platformCreateMutex(void);
  945. /*
  946. * Destroy a platform-specific mutex, and clean up any resources associated
  947. * with it. (mutex) is a value previously returned by
  948. * __PHYSFS_platformCreateMutex(). This can be a no-op on single-threaded
  949. * platforms.
  950. */
  951. void __PHYSFS_platformDestroyMutex(void *mutex);
  952. /*
  953. * Grab possession of a platform-specific mutex. Mutexes should be recursive;
  954. * that is, the same thread should be able to call this function multiple
  955. * times in a row without causing a deadlock. This function should block
  956. * until a thread can gain possession of the mutex.
  957. *
  958. * Return non-zero if the mutex was grabbed, zero if there was an
  959. * unrecoverable problem grabbing it (this should not be a matter of
  960. * timing out! We're talking major system errors; block until the mutex
  961. * is available otherwise.)
  962. *
  963. * _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
  964. * function, you'll cause an infinite recursion. This means you can't
  965. * use the BAIL_*MACRO* macros, either.
  966. */
  967. int __PHYSFS_platformGrabMutex(void *mutex);
  968. /*
  969. * Relinquish possession of the mutex when this method has been called
  970. * once for each time that platformGrabMutex was called. Once possession has
  971. * been released, the next thread in line to grab the mutex (if any) may
  972. * proceed.
  973. *
  974. * _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
  975. * function, you'll cause an infinite recursion. This means you can't
  976. * use the BAIL_*MACRO* macros, either.
  977. */
  978. void __PHYSFS_platformReleaseMutex(void *mutex);
  979. #ifdef __cplusplus
  980. }
  981. #endif
  982. #endif
  983. /* end of physfs_internal.h ... */