physfs_internal.h 46 KB

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