physfs_internal.h 51 KB

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