physfs_internal.h 36 KB

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