physfs_internal.h 42 KB

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