physfs_internal.h 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355
  1. /*
  2. * Internal function/structure declaration. Do NOT include in your
  3. * application.
  4. *
  5. * Please see the file LICENSE.txt 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. /* The holy trinity. */
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include "physfs_platforms.h"
  20. #ifdef HAVE_ASSERT_H
  21. #include <assert.h>
  22. #elif (!defined assert)
  23. #define assert(x)
  24. #endif
  25. /* !!! FIXME: remove this when revamping stack allocation code... */
  26. #if defined(_MSC_VER) || defined(__MINGW32__)
  27. #include <malloc.h>
  28. #endif
  29. #if defined(__sun) || defined(sun)
  30. #include <alloca.h>
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifdef __GNUC__
  36. #define PHYSFS_MINIMUM_GCC_VERSION(major, minor) \
  37. ( ((__GNUC__ << 16) + __GNUC_MINOR__) >= (((major) << 16) + (minor)) )
  38. #else
  39. #define PHYSFS_MINIMUM_GCC_VERSION(major, minor) (0)
  40. #endif
  41. #ifdef __cplusplus
  42. /* C++ always has a real inline keyword. */
  43. #elif (defined macintosh) && !(defined __MWERKS__)
  44. # define inline
  45. #elif (defined _MSC_VER)
  46. # define inline __inline
  47. #endif
  48. #if PHYSFS_PLATFORM_LINUX && !defined(_FILE_OFFSET_BITS)
  49. #define _FILE_OFFSET_BITS 64
  50. #endif
  51. /*
  52. * Interface for small allocations. If you need a little scratch space for
  53. * a throwaway buffer or string, use this. It will make small allocations
  54. * on the stack if possible, and use allocator.Malloc() if they are too
  55. * large. This helps reduce malloc pressure.
  56. * There are some rules, though:
  57. * NEVER return a pointer from this, as stack-allocated buffers go away
  58. * when your function returns.
  59. * NEVER allocate in a loop, as stack-allocated pointers will pile up. Call
  60. * a function that uses smallAlloc from your loop, so the allocation can
  61. * free each time.
  62. * NEVER call smallAlloc with any complex expression (it's a macro that WILL
  63. * have side effects...it references the argument multiple times). Use a
  64. * variable or a literal.
  65. * NEVER free a pointer from this with anything but smallFree. It will not
  66. * be a valid pointer to the allocator, regardless of where the memory came
  67. * from.
  68. * NEVER realloc a pointer from this.
  69. * NEVER forget to use smallFree: it may not be a pointer from the stack.
  70. * NEVER forget to check for NULL...allocation can fail here, of course!
  71. */
  72. #define __PHYSFS_SMALLALLOCTHRESHOLD 256
  73. void *__PHYSFS_initSmallAlloc(void *ptr, PHYSFS_uint64 len);
  74. #define __PHYSFS_smallAlloc(bytes) ( \
  75. __PHYSFS_initSmallAlloc( \
  76. (((bytes) < __PHYSFS_SMALLALLOCTHRESHOLD) ? \
  77. alloca((size_t)((bytes)+sizeof(void*))) : NULL), (bytes)) \
  78. )
  79. void __PHYSFS_smallFree(void *ptr);
  80. /* Use the allocation hooks. */
  81. #define malloc(x) Do not use malloc() directly.
  82. #define realloc(x, y) Do not use realloc() directly.
  83. #define free(x) Do not use free() directly.
  84. /* !!! FIXME: add alloca check here. */
  85. /* The LANG section. */
  86. /* please send questions/translations to Ryan: icculus@icculus.org. */
  87. #if (!defined PHYSFS_LANG)
  88. # define PHYSFS_LANG PHYSFS_LANG_ENGLISH
  89. #endif
  90. /* All language strings are UTF-8 encoded! */
  91. #define PHYSFS_LANG_ENGLISH 1 /* English by Ryan C. Gordon */
  92. #define PHYSFS_LANG_RUSSIAN 2 /* Russian by Ed Sinjiashvili */
  93. #define PHYSFS_LANG_SPANISH 3 /* Spanish by Pedro J. Pérez */
  94. #define PHYSFS_LANG_FRENCH 4 /* French by Stéphane Peter */
  95. #define PHYSFS_LANG_GERMAN 5 /* German by Michael Renner */
  96. #define PHYSFS_LANG_PORTUGUESE_BR 6 /* pt-br by Danny Angelo Carminati Grein */
  97. #if (PHYSFS_LANG == PHYSFS_LANG_ENGLISH)
  98. #define DIR_ARCHIVE_DESCRIPTION "Non-archive, direct filesystem I/O"
  99. #define GRP_ARCHIVE_DESCRIPTION "Build engine Groupfile format"
  100. #define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
  101. #define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
  102. #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  103. #define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip compatible"
  104. #define WAD_ARCHIVE_DESCRIPTION "DOOM engine format"
  105. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format"
  106. #define ERR_IS_INITIALIZED "Already initialized"
  107. #define ERR_NOT_INITIALIZED "Not initialized"
  108. #define ERR_INVALID_ARGUMENT "Invalid argument"
  109. #define ERR_FILES_STILL_OPEN "Files still open"
  110. #define ERR_NO_DIR_CREATE "Failed to create directories"
  111. #define ERR_OUT_OF_MEMORY "Out of memory"
  112. #define ERR_NOT_IN_SEARCH_PATH "No such entry in search path"
  113. #define ERR_NOT_SUPPORTED "Operation not supported"
  114. #define ERR_UNSUPPORTED_ARCHIVE "Archive type unsupported"
  115. #define ERR_NOT_A_HANDLE "Not a file handle"
  116. #define ERR_INSECURE_FNAME "Insecure filename"
  117. #define ERR_SYMLINK_DISALLOWED "Symbolic links are disabled"
  118. #define ERR_NO_WRITE_DIR "Write directory is not set"
  119. #define ERR_NO_SUCH_FILE "File not found"
  120. #define ERR_NO_SUCH_PATH "Path not found"
  121. #define ERR_NO_SUCH_VOLUME "Volume not found"
  122. #define ERR_PAST_EOF "Past end of file"
  123. #define ERR_ARC_IS_READ_ONLY "Archive is read-only"
  124. #define ERR_IO_ERROR "I/O error"
  125. #define ERR_CANT_SET_WRITE_DIR "Can't set write directory"
  126. #define ERR_SYMLINK_LOOP "Infinite symbolic link loop"
  127. #define ERR_COMPRESSION "(De)compression error"
  128. #define ERR_NOT_IMPLEMENTED "Not implemented"
  129. #define ERR_OS_ERROR "Operating system reported error"
  130. #define ERR_FILE_EXISTS "File already exists"
  131. #define ERR_NOT_A_FILE "Not a file"
  132. #define ERR_NOT_A_DIR "Not a directory"
  133. #define ERR_NOT_AN_ARCHIVE "Not an archive"
  134. #define ERR_CORRUPTED "Corrupted archive"
  135. #define ERR_SEEK_OUT_OF_RANGE "Seek out of range"
  136. #define ERR_BAD_FILENAME "Bad filename"
  137. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS made a bad system call"
  138. #define ERR_ARGV0_IS_NULL "argv0 is NULL"
  139. #define ERR_NEED_DICT "need dictionary"
  140. #define ERR_DATA_ERROR "data error"
  141. #define ERR_MEMORY_ERROR "memory error"
  142. #define ERR_BUFFER_ERROR "buffer error"
  143. #define ERR_VERSION_ERROR "version error"
  144. #define ERR_UNKNOWN_ERROR "unknown error"
  145. #define ERR_SEARCHPATH_TRUNC "Search path was truncated"
  146. #define ERR_GETMODFN_TRUNC "GetModuleFileName() was truncated"
  147. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() had no dir"
  148. #define ERR_DISK_FULL "Disk is full"
  149. #define ERR_DIRECTORY_FULL "Directory full"
  150. #define ERR_MACOS_GENERIC "MacOS reported error (%d)"
  151. #define ERR_VOL_LOCKED_HW "Volume is locked through hardware"
  152. #define ERR_VOL_LOCKED_SW "Volume is locked through software"
  153. #define ERR_FILE_LOCKED "File is locked"
  154. #define ERR_FILE_OR_DIR_BUSY "File/directory is busy"
  155. #define ERR_FILE_ALREADY_OPEN_W "File already open for writing"
  156. #define ERR_FILE_ALREADY_OPEN_R "File already open for reading"
  157. #define ERR_INVALID_REFNUM "Invalid reference number"
  158. #define ERR_GETTING_FILE_POS "Error getting file position"
  159. #define ERR_VOLUME_OFFLINE "Volume is offline"
  160. #define ERR_PERMISSION_DENIED "Permission denied"
  161. #define ERR_VOL_ALREADY_ONLINE "Volume already online"
  162. #define ERR_NO_SUCH_DRIVE "No such drive"
  163. #define ERR_NOT_MAC_DISK "Not a Macintosh disk"
  164. #define ERR_VOL_EXTERNAL_FS "Volume belongs to an external filesystem"
  165. #define ERR_PROBLEM_RENAME "Problem during rename"
  166. #define ERR_BAD_MASTER_BLOCK "Bad master directory block"
  167. #define ERR_CANT_MOVE_FORBIDDEN "Attempt to move forbidden"
  168. #define ERR_WRONG_VOL_TYPE "Wrong volume type"
  169. #define ERR_SERVER_VOL_LOST "Server volume has been disconnected"
  170. #define ERR_FILE_ID_NOT_FOUND "File ID not found"
  171. #define ERR_FILE_ID_EXISTS "File ID already exists"
  172. #define ERR_SERVER_NO_RESPOND "Server not responding"
  173. #define ERR_USER_AUTH_FAILED "User authentication failed"
  174. #define ERR_PWORD_EXPIRED "Password has expired on server"
  175. #define ERR_ACCESS_DENIED "Access denied"
  176. #define ERR_NOT_A_DOS_DISK "Not a DOS disk"
  177. #define ERR_SHARING_VIOLATION "Sharing violation"
  178. #define ERR_CANNOT_MAKE "Cannot make"
  179. #define ERR_DEV_IN_USE "Device already in use"
  180. #define ERR_OPEN_FAILED "Open failed"
  181. #define ERR_PIPE_BUSY "Pipe is busy"
  182. #define ERR_SHARING_BUF_EXCEEDED "Sharing buffer exceeded"
  183. #define ERR_TOO_MANY_HANDLES "Too many open handles"
  184. #define ERR_SEEK_ERROR "Seek error"
  185. #define ERR_DEL_CWD "Trying to delete current working directory"
  186. #define ERR_WRITE_PROTECT_ERROR "Write protect error"
  187. #define ERR_WRITE_FAULT "Write fault"
  188. #define ERR_LOCK_VIOLATION "Lock violation"
  189. #define ERR_GEN_FAILURE "General failure"
  190. #define ERR_UNCERTAIN_MEDIA "Uncertain media"
  191. #define ERR_PROT_VIOLATION "Protection violation"
  192. #define ERR_BROKEN_PIPE "Broken pipe"
  193. #elif (PHYSFS_LANG == PHYSFS_LANG_GERMAN)
  194. #define DIR_ARCHIVE_DESCRIPTION "Kein Archiv, direkte Ein/Ausgabe in das Dateisystem"
  195. #define GRP_ARCHIVE_DESCRIPTION "Build engine Groupfile format"
  196. #define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
  197. #define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
  198. #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  199. #define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip kompatibel"
  200. #define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" /* !!! FIXME: translate this line if needed */
  201. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  202. #define ERR_IS_INITIALIZED "Bereits initialisiert"
  203. #define ERR_NOT_INITIALIZED "Nicht initialisiert"
  204. #define ERR_INVALID_ARGUMENT "Ungültiges Argument"
  205. #define ERR_FILES_STILL_OPEN "Dateien noch immer geöffnet"
  206. #define ERR_NO_DIR_CREATE "Fehler beim Erzeugen der Verzeichnisse"
  207. #define ERR_OUT_OF_MEMORY "Kein Speicher mehr frei"
  208. #define ERR_NOT_IN_SEARCH_PATH "Eintrag nicht im Suchpfad enthalten"
  209. #define ERR_NOT_SUPPORTED "Befehl nicht unterstützt"
  210. #define ERR_UNSUPPORTED_ARCHIVE "Archiv-Typ nicht unterstützt"
  211. #define ERR_NOT_A_HANDLE "Ist kein Dateideskriptor"
  212. #define ERR_INSECURE_FNAME "Unsicherer Dateiname"
  213. #define ERR_SYMLINK_DISALLOWED "Symbolische Verweise deaktiviert"
  214. #define ERR_NO_WRITE_DIR "Schreibverzeichnis ist nicht gesetzt"
  215. #define ERR_NO_SUCH_FILE "Datei nicht gefunden"
  216. #define ERR_NO_SUCH_PATH "Pfad nicht gefunden"
  217. #define ERR_NO_SUCH_VOLUME "Datencontainer nicht gefunden"
  218. #define ERR_PAST_EOF "Hinter dem Ende der Datei"
  219. #define ERR_ARC_IS_READ_ONLY "Archiv ist schreibgeschützt"
  220. #define ERR_IO_ERROR "Ein/Ausgabe Fehler"
  221. #define ERR_CANT_SET_WRITE_DIR "Kann Schreibverzeichnis nicht setzen"
  222. #define ERR_SYMLINK_LOOP "Endlosschleife durch symbolische Verweise"
  223. #define ERR_COMPRESSION "(De)Kompressionsfehler"
  224. #define ERR_NOT_IMPLEMENTED "Nicht implementiert"
  225. #define ERR_OS_ERROR "Betriebssystem meldete Fehler"
  226. #define ERR_FILE_EXISTS "Datei existiert bereits"
  227. #define ERR_NOT_A_FILE "Ist keine Datei"
  228. #define ERR_NOT_A_DIR "Ist kein Verzeichnis"
  229. #define ERR_NOT_AN_ARCHIVE "Ist kein Archiv"
  230. #define ERR_CORRUPTED "Beschädigtes Archiv"
  231. #define ERR_SEEK_OUT_OF_RANGE "Suche war ausserhalb der Reichweite"
  232. #define ERR_BAD_FILENAME "Unzulässiger Dateiname"
  233. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS verursachte einen ungültigen Systemaufruf"
  234. #define ERR_ARGV0_IS_NULL "argv0 ist NULL"
  235. #define ERR_NEED_DICT "brauche Wörterbuch"
  236. #define ERR_DATA_ERROR "Datenfehler"
  237. #define ERR_MEMORY_ERROR "Speicherfehler"
  238. #define ERR_BUFFER_ERROR "Bufferfehler"
  239. #define ERR_VERSION_ERROR "Versionskonflikt"
  240. #define ERR_UNKNOWN_ERROR "Unbekannter Fehler"
  241. #define ERR_SEARCHPATH_TRUNC "Suchpfad war abgeschnitten"
  242. #define ERR_GETMODFN_TRUNC "GetModuleFileName() war abgeschnitten"
  243. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() bekam kein Verzeichnis"
  244. #define ERR_DISK_FULL "Laufwerk ist voll"
  245. #define ERR_DIRECTORY_FULL "Verzeichnis ist voll"
  246. #define ERR_MACOS_GENERIC "MacOS meldete Fehler (%d)"
  247. #define ERR_VOL_LOCKED_HW "Datencontainer ist durch Hardware gesperrt"
  248. #define ERR_VOL_LOCKED_SW "Datencontainer ist durch Software gesperrt"
  249. #define ERR_FILE_LOCKED "Datei ist gesperrt"
  250. #define ERR_FILE_OR_DIR_BUSY "Datei/Verzeichnis ist beschäftigt"
  251. #define ERR_FILE_ALREADY_OPEN_W "Datei schon im Schreibmodus geöffnet"
  252. #define ERR_FILE_ALREADY_OPEN_R "Datei schon im Lesemodus geöffnet"
  253. #define ERR_INVALID_REFNUM "Ungültige Referenznummer"
  254. #define ERR_GETTING_FILE_POS "Fehler beim Finden der Dateiposition"
  255. #define ERR_VOLUME_OFFLINE "Datencontainer ist offline"
  256. #define ERR_PERMISSION_DENIED "Zugriff verweigert"
  257. #define ERR_VOL_ALREADY_ONLINE "Datencontainer ist bereits online"
  258. #define ERR_NO_SUCH_DRIVE "Laufwerk nicht vorhanden"
  259. #define ERR_NOT_MAC_DISK "Ist kein Macintosh Laufwerk"
  260. #define ERR_VOL_EXTERNAL_FS "Datencontainer liegt auf einem externen Dateisystem"
  261. #define ERR_PROBLEM_RENAME "Fehler beim Umbenennen"
  262. #define ERR_BAD_MASTER_BLOCK "Beschädigter Hauptverzeichnisblock"
  263. #define ERR_CANT_MOVE_FORBIDDEN "Verschieben nicht erlaubt"
  264. #define ERR_WRONG_VOL_TYPE "Falscher Datencontainer-Typ"
  265. #define ERR_SERVER_VOL_LOST "Datencontainer am Server wurde getrennt"
  266. #define ERR_FILE_ID_NOT_FOUND "Dateikennung nicht gefunden"
  267. #define ERR_FILE_ID_EXISTS "Dateikennung existiert bereits"
  268. #define ERR_SERVER_NO_RESPOND "Server antwortet nicht"
  269. #define ERR_USER_AUTH_FAILED "Benutzerauthentifizierung fehlgeschlagen"
  270. #define ERR_PWORD_EXPIRED "Passwort am Server ist abgelaufen"
  271. #define ERR_ACCESS_DENIED "Zugriff verweigert"
  272. #define ERR_NOT_A_DOS_DISK "Ist kein DOS-Laufwerk"
  273. #define ERR_SHARING_VIOLATION "Zugriffsverletzung"
  274. #define ERR_CANNOT_MAKE "Kann nicht erzeugen"
  275. #define ERR_DEV_IN_USE "Gerät wird bereits benutzt"
  276. #define ERR_OPEN_FAILED "Öffnen fehlgeschlagen"
  277. #define ERR_PIPE_BUSY "Pipeverbindung ist belegt"
  278. #define ERR_SHARING_BUF_EXCEEDED "Zugriffsbuffer überschritten"
  279. #define ERR_TOO_MANY_HANDLES "Zu viele offene Dateien"
  280. #define ERR_SEEK_ERROR "Fehler beim Suchen"
  281. #define ERR_DEL_CWD "Aktuelles Arbeitsverzeichnis darf nicht gelöscht werden"
  282. #define ERR_WRITE_PROTECT_ERROR "Schreibschutzfehler"
  283. #define ERR_WRITE_FAULT "Schreibfehler"
  284. #define ERR_LOCK_VIOLATION "Sperrverletzung"
  285. #define ERR_GEN_FAILURE "Allgemeiner Fehler"
  286. #define ERR_UNCERTAIN_MEDIA "Unsicheres Medium"
  287. #define ERR_PROT_VIOLATION "Schutzverletzung"
  288. #define ERR_BROKEN_PIPE "Pipeverbindung unterbrochen"
  289. #elif (PHYSFS_LANG == PHYSFS_LANG_RUSSIAN)
  290. #define DIR_ARCHIVE_DESCRIPTION "Не архив, непосредственный ввод/вывод файловой системы"
  291. #define GRP_ARCHIVE_DESCRIPTION "Формат группового файла Build engine"
  292. #define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
  293. #define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
  294. #define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip совместимый"
  295. #define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" /* !!! FIXME: translate this line if needed */
  296. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  297. #define ERR_IS_INITIALIZED "Уже инициализирован"
  298. #define ERR_NOT_INITIALIZED "Не инициализирован"
  299. #define ERR_INVALID_ARGUMENT "Неверный аргумент"
  300. #define ERR_FILES_STILL_OPEN "Файлы еще открыты"
  301. #define ERR_NO_DIR_CREATE "Не могу создать каталоги"
  302. #define ERR_OUT_OF_MEMORY "Кончилась память"
  303. #define ERR_NOT_IN_SEARCH_PATH "Нет такого элемента в пути поиска"
  304. #define ERR_NOT_SUPPORTED "Операция не поддерживается"
  305. #define ERR_UNSUPPORTED_ARCHIVE "Архивы такого типа не поддерживаются"
  306. #define ERR_NOT_A_HANDLE "Не файловый дескриптор"
  307. #define ERR_INSECURE_FNAME "Небезопасное имя файла"
  308. #define ERR_SYMLINK_DISALLOWED "Символьные ссылки отключены"
  309. #define ERR_NO_WRITE_DIR "Каталог для записи не установлен"
  310. #define ERR_NO_SUCH_FILE "Файл не найден"
  311. #define ERR_NO_SUCH_PATH "Путь не найден"
  312. #define ERR_NO_SUCH_VOLUME "Том не найден"
  313. #define ERR_PAST_EOF "За концом файла"
  314. #define ERR_ARC_IS_READ_ONLY "Архив только для чтения"
  315. #define ERR_IO_ERROR "Ошибка ввода/вывода"
  316. #define ERR_CANT_SET_WRITE_DIR "Не могу установить каталог для записи"
  317. #define ERR_SYMLINK_LOOP "Бесконечный цикл символьной ссылки"
  318. #define ERR_COMPRESSION "Ошибка (Рас)паковки"
  319. #define ERR_NOT_IMPLEMENTED "Не реализовано"
  320. #define ERR_OS_ERROR "Операционная система сообщила ошибку"
  321. #define ERR_FILE_EXISTS "Файл уже существует"
  322. #define ERR_NOT_A_FILE "Не файл"
  323. #define ERR_NOT_A_DIR "Не каталог"
  324. #define ERR_NOT_AN_ARCHIVE "Не архив"
  325. #define ERR_CORRUPTED "Поврежденный архив"
  326. #define ERR_SEEK_OUT_OF_RANGE "Позиционирование за пределы"
  327. #define ERR_BAD_FILENAME "Неверное имя файла"
  328. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS выполнила неверный системный вызов"
  329. #define ERR_ARGV0_IS_NULL "argv0 is NULL"
  330. #define ERR_NEED_DICT "нужен словарь"
  331. #define ERR_DATA_ERROR "ошибка данных"
  332. #define ERR_MEMORY_ERROR "ошибка памяти"
  333. #define ERR_BUFFER_ERROR "ошибка буфера"
  334. #define ERR_VERSION_ERROR "ошибка версии"
  335. #define ERR_UNKNOWN_ERROR "неизвестная ошибка"
  336. #define ERR_SEARCHPATH_TRUNC "Путь поиска обрезан"
  337. #define ERR_GETMODFN_TRUNC "GetModuleFileName() обрезан"
  338. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() не получил каталог"
  339. #define ERR_DISK_FULL "Диск полон"
  340. #define ERR_DIRECTORY_FULL "Каталог полон"
  341. #define ERR_MACOS_GENERIC "MacOS сообщила ошибку (%d)"
  342. #define ERR_VOL_LOCKED_HW "Том блокирован аппаратно"
  343. #define ERR_VOL_LOCKED_SW "Том блокирован программно"
  344. #define ERR_FILE_LOCKED "Файл заблокирован"
  345. #define ERR_FILE_OR_DIR_BUSY "Файл/каталог занят"
  346. #define ERR_FILE_ALREADY_OPEN_W "Файл уже открыт на запись"
  347. #define ERR_FILE_ALREADY_OPEN_R "Файл уже открыт на чтение"
  348. #define ERR_INVALID_REFNUM "Неверное количество ссылок"
  349. #define ERR_GETTING_FILE_POS "Ошибка при получении позиции файла"
  350. #define ERR_VOLUME_OFFLINE "Том отсоединен"
  351. #define ERR_PERMISSION_DENIED "Отказано в разрешении"
  352. #define ERR_VOL_ALREADY_ONLINE "Том уже подсоединен"
  353. #define ERR_NO_SUCH_DRIVE "Нет такого диска"
  354. #define ERR_NOT_MAC_DISK "Не диск Macintosh"
  355. #define ERR_VOL_EXTERNAL_FS "Том принадлежит внешней файловой системе"
  356. #define ERR_PROBLEM_RENAME "Проблема при переименовании"
  357. #define ERR_BAD_MASTER_BLOCK "Плохой главный блок каталога"
  358. #define ERR_CANT_MOVE_FORBIDDEN "Попытка переместить запрещена"
  359. #define ERR_WRONG_VOL_TYPE "Неверный тип тома"
  360. #define ERR_SERVER_VOL_LOST "Серверный том был отсоединен"
  361. #define ERR_FILE_ID_NOT_FOUND "Идентификатор файла не найден"
  362. #define ERR_FILE_ID_EXISTS "Идентификатор файла уже существует"
  363. #define ERR_SERVER_NO_RESPOND "Сервер не отвечает"
  364. #define ERR_USER_AUTH_FAILED "Идентификация пользователя не удалась"
  365. #define ERR_PWORD_EXPIRED "Пароль на сервере устарел"
  366. #define ERR_ACCESS_DENIED "Отказано в доступе"
  367. #define ERR_NOT_A_DOS_DISK "Не диск DOS"
  368. #define ERR_SHARING_VIOLATION "Нарушение совместного доступа"
  369. #define ERR_CANNOT_MAKE "Не могу собрать"
  370. #define ERR_DEV_IN_USE "Устройство уже используется"
  371. #define ERR_OPEN_FAILED "Открытие не удалось"
  372. #define ERR_PIPE_BUSY "Конвейер занят"
  373. #define ERR_SHARING_BUF_EXCEEDED "Разделяемый буфер переполнен"
  374. #define ERR_TOO_MANY_HANDLES "Слишком много открытых дескрипторов"
  375. #define ERR_SEEK_ERROR "Ошибка позиционирования"
  376. #define ERR_DEL_CWD "Попытка удалить текущий рабочий каталог"
  377. #define ERR_WRITE_PROTECT_ERROR "Ошибка защиты записи"
  378. #define ERR_WRITE_FAULT "Ошибка записи"
  379. #define ERR_LOCK_VIOLATION "Нарушение блокировки"
  380. #define ERR_GEN_FAILURE "Общий сбой"
  381. #define ERR_UNCERTAIN_MEDIA "Неопределенный носитель"
  382. #define ERR_PROT_VIOLATION "Нарушение защиты"
  383. #define ERR_BROKEN_PIPE "Сломанный конвейер"
  384. #elif (PHYSFS_LANG == PHYSFS_LANG_FRENCH)
  385. #define DIR_ARCHIVE_DESCRIPTION "Pas d'archive, E/S directes sur système de fichiers"
  386. #define GRP_ARCHIVE_DESCRIPTION "Format Groupfile du moteur Build"
  387. #define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
  388. #define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
  389. #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  390. #define ZIP_ARCHIVE_DESCRIPTION "Compatible PkZip/WinZip/Info-Zip"
  391. #define WAD_ARCHIVE_DESCRIPTION "Format WAD du moteur DOOM"
  392. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  393. #define ERR_IS_INITIALIZED "Déjà initialisé"
  394. #define ERR_NOT_INITIALIZED "Non initialisé"
  395. #define ERR_INVALID_ARGUMENT "Argument invalide"
  396. #define ERR_FILES_STILL_OPEN "Fichiers encore ouverts"
  397. #define ERR_NO_DIR_CREATE "Echec de la création de répertoires"
  398. #define ERR_OUT_OF_MEMORY "A court de mémoire"
  399. #define ERR_NOT_IN_SEARCH_PATH "Aucune entrée dans le chemin de recherche"
  400. #define ERR_NOT_SUPPORTED "Opération non supportée"
  401. #define ERR_UNSUPPORTED_ARCHIVE "Type d'archive non supportée"
  402. #define ERR_NOT_A_HANDLE "Pas un descripteur de fichier"
  403. #define ERR_INSECURE_FNAME "Nom de fichier dangereux"
  404. #define ERR_SYMLINK_DISALLOWED "Les liens symboliques sont désactivés"
  405. #define ERR_NO_WRITE_DIR "Le répertoire d'écriture n'est pas spécifié"
  406. #define ERR_NO_SUCH_FILE "Fichier non trouvé"
  407. #define ERR_NO_SUCH_PATH "Chemin non trouvé"
  408. #define ERR_NO_SUCH_VOLUME "Volume non trouvé"
  409. #define ERR_PAST_EOF "Au-delà de la fin du fichier"
  410. #define ERR_ARC_IS_READ_ONLY "L'archive est en lecture seule"
  411. #define ERR_IO_ERROR "Erreur E/S"
  412. #define ERR_CANT_SET_WRITE_DIR "Ne peut utiliser le répertoire d'écriture"
  413. #define ERR_SYMLINK_LOOP "Boucle infinie dans les liens symboliques"
  414. #define ERR_COMPRESSION "Erreur de (dé)compression"
  415. #define ERR_NOT_IMPLEMENTED "Non implémenté"
  416. #define ERR_OS_ERROR "Erreur rapportée par le système d'exploitation"
  417. #define ERR_FILE_EXISTS "Le fichier existe déjà"
  418. #define ERR_NOT_A_FILE "Pas un fichier"
  419. #define ERR_NOT_A_DIR "Pas un répertoire"
  420. #define ERR_NOT_AN_ARCHIVE "Pas une archive"
  421. #define ERR_CORRUPTED "Archive corrompue"
  422. #define ERR_SEEK_OUT_OF_RANGE "Pointeur de fichier hors de portée"
  423. #define ERR_BAD_FILENAME "Mauvais nom de fichier"
  424. #define ERR_PHYSFS_BAD_OS_CALL "(BOGUE) PhysicsFS a fait un mauvais appel système, le salaud"
  425. #define ERR_ARGV0_IS_NULL "argv0 est NULL"
  426. #define ERR_NEED_DICT "a besoin du dico"
  427. #define ERR_DATA_ERROR "erreur de données"
  428. #define ERR_MEMORY_ERROR "erreur mémoire"
  429. #define ERR_BUFFER_ERROR "erreur tampon"
  430. #define ERR_VERSION_ERROR "erreur de version"
  431. #define ERR_UNKNOWN_ERROR "erreur inconnue"
  432. #define ERR_SEARCHPATH_TRUNC "Le chemin de recherche a été tronqué"
  433. #define ERR_GETMODFN_TRUNC "GetModuleFileName() a été tronqué"
  434. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() n'a pas de répertoire"
  435. #define ERR_DISK_FULL "Disque plein"
  436. #define ERR_DIRECTORY_FULL "Répertoire plein"
  437. #define ERR_MACOS_GENERIC "Erreur rapportée par MacOS (%d)"
  438. #define ERR_VOL_LOCKED_HW "Le volume est verrouillé matériellement"
  439. #define ERR_VOL_LOCKED_SW "Le volume est verrouillé par logiciel"
  440. #define ERR_FILE_LOCKED "Fichier verrouillé"
  441. #define ERR_FILE_OR_DIR_BUSY "Fichier/répertoire occupé"
  442. #define ERR_FILE_ALREADY_OPEN_W "Fichier déjà ouvert en écriture"
  443. #define ERR_FILE_ALREADY_OPEN_R "Fichier déjà ouvert en lecture"
  444. #define ERR_INVALID_REFNUM "Numéro de référence invalide"
  445. #define ERR_GETTING_FILE_POS "Erreur lors de l'obtention de la position du pointeur de fichier"
  446. #define ERR_VOLUME_OFFLINE "Le volume n'est pas en ligne"
  447. #define ERR_PERMISSION_DENIED "Permission refusée"
  448. #define ERR_VOL_ALREADY_ONLINE "Volumé déjà en ligne"
  449. #define ERR_NO_SUCH_DRIVE "Lecteur inexistant"
  450. #define ERR_NOT_MAC_DISK "Pas un disque Macintosh"
  451. #define ERR_VOL_EXTERNAL_FS "Le volume appartient à un système de fichiers externe"
  452. #define ERR_PROBLEM_RENAME "Problème lors du renommage"
  453. #define ERR_BAD_MASTER_BLOCK "Mauvais block maitre de répertoire"
  454. #define ERR_CANT_MOVE_FORBIDDEN "Essai de déplacement interdit"
  455. #define ERR_WRONG_VOL_TYPE "Mauvais type de volume"
  456. #define ERR_SERVER_VOL_LOST "Le volume serveur a été déconnecté"
  457. #define ERR_FILE_ID_NOT_FOUND "Identificateur de fichier non trouvé"
  458. #define ERR_FILE_ID_EXISTS "Identificateur de fichier existe déjà"
  459. #define ERR_SERVER_NO_RESPOND "Le serveur ne répond pas"
  460. #define ERR_USER_AUTH_FAILED "Authentification de l'utilisateur échouée"
  461. #define ERR_PWORD_EXPIRED "Le mot de passe a expiré sur le serveur"
  462. #define ERR_ACCESS_DENIED "Accès refusé"
  463. #define ERR_NOT_A_DOS_DISK "Pas un disque DOS"
  464. #define ERR_SHARING_VIOLATION "Violation de partage"
  465. #define ERR_CANNOT_MAKE "Ne peut faire"
  466. #define ERR_DEV_IN_USE "Périphérique déjà en utilisation"
  467. #define ERR_OPEN_FAILED "Ouverture échouée"
  468. #define ERR_PIPE_BUSY "Le tube est occupé"
  469. #define ERR_SHARING_BUF_EXCEEDED "Tampon de partage dépassé"
  470. #define ERR_TOO_MANY_HANDLES "Trop de descripteurs ouverts"
  471. #define ERR_SEEK_ERROR "Erreur de positionement"
  472. #define ERR_DEL_CWD "Essai de supprimer le répertoire courant"
  473. #define ERR_WRITE_PROTECT_ERROR "Erreur de protection en écriture"
  474. #define ERR_WRITE_FAULT "Erreur d'écriture"
  475. #define ERR_LOCK_VIOLATION "Violation de verrou"
  476. #define ERR_GEN_FAILURE "Echec général"
  477. #define ERR_UNCERTAIN_MEDIA "Média incertain"
  478. #define ERR_PROT_VIOLATION "Violation de protection"
  479. #define ERR_BROKEN_PIPE "Tube cassé"
  480. #elif (PHYSFS_LANG == PHYSFS_LANG_PORTUGUESE_BR)
  481. #define DIR_ARCHIVE_DESCRIPTION "Não arquivo, E/S sistema de arquivos direto"
  482. #define GRP_ARCHIVE_DESCRIPTION "Formato Groupfile do engine Build"
  483. #define HOG_ARCHIVE_DESCRIPTION "Formato Descent I/II HOG file"
  484. #define MVL_ARCHIVE_DESCRIPTION "Formato Descent II Movielib"
  485. #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
  486. #define ZIP_ARCHIVE_DESCRIPTION "Formato compatível PkZip/WinZip/Info-Zip"
  487. #define WAD_ARCHIVE_DESCRIPTION "Formato WAD do engine DOOM"
  488. #define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" /* !!! FIXME: translate this line if needed */
  489. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  490. #define ERR_IS_INITIALIZED "Já inicializado"
  491. #define ERR_NOT_INITIALIZED "Não inicializado"
  492. #define ERR_INVALID_ARGUMENT "Argumento inválido"
  493. #define ERR_FILES_STILL_OPEN "Arquivos ainda abertos"
  494. #define ERR_NO_DIR_CREATE "Falha na criação de diretórios"
  495. #define ERR_OUT_OF_MEMORY "Memória insuficiente"
  496. #define ERR_NOT_IN_SEARCH_PATH "Entrada não encontrada no caminho de busca"
  497. #define ERR_NOT_SUPPORTED "Operação não suportada"
  498. #define ERR_UNSUPPORTED_ARCHIVE "Tipo de arquivo não suportado"
  499. #define ERR_NOT_A_HANDLE "Não é um handler de arquivo"
  500. #define ERR_INSECURE_FNAME "Nome de arquivo inseguro"
  501. #define ERR_SYMLINK_DISALLOWED "Links simbólicos desabilitados"
  502. #define ERR_NO_WRITE_DIR "Diretório de escrita não definido"
  503. #define ERR_NO_SUCH_FILE "Arquivo não encontrado"
  504. #define ERR_NO_SUCH_PATH "Caminho não encontrado"
  505. #define ERR_NO_SUCH_VOLUME "Volume não encontrado"
  506. #define ERR_PAST_EOF "Passou o fim do arquivo"
  507. #define ERR_ARC_IS_READ_ONLY "Arquivo é somente de leitura"
  508. #define ERR_IO_ERROR "Erro de E/S"
  509. #define ERR_CANT_SET_WRITE_DIR "Não foi possível definir diretório de escrita"
  510. #define ERR_SYMLINK_LOOP "Loop infinito de link simbólico"
  511. #define ERR_COMPRESSION "Erro de (Des)compressão"
  512. #define ERR_NOT_IMPLEMENTED "Não implementado"
  513. #define ERR_OS_ERROR "Erro reportado pelo Sistema Operacional"
  514. #define ERR_FILE_EXISTS "Arquivo já existente"
  515. #define ERR_NOT_A_FILE "Não é um arquivo"
  516. #define ERR_NOT_A_DIR "Não é um diretório"
  517. #define ERR_NOT_AN_ARCHIVE "Não é um pacote"
  518. #define ERR_CORRUPTED "Pacote corrompido"
  519. #define ERR_SEEK_OUT_OF_RANGE "Posicionamento além do tamanho"
  520. #define ERR_BAD_FILENAME "Nome de arquivo inválido"
  521. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS realizou uma chamada de sistema inválida"
  522. #define ERR_ARGV0_IS_NULL "argv0 é NULL"
  523. #define ERR_NEED_DICT "precisa de diretório"
  524. #define ERR_DATA_ERROR "erro nos dados"
  525. #define ERR_MEMORY_ERROR "erro de memória"
  526. #define ERR_BUFFER_ERROR "erro de buffer"
  527. #define ERR_VERSION_ERROR "erro na version"
  528. #define ERR_UNKNOWN_ERROR "erro desconhecido"
  529. #define ERR_SEARCHPATH_TRUNC "Caminho de procura quebrado"
  530. #define ERR_GETMODFN_TRUNC "GetModuleFileName() foi quebrado"
  531. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() nao teve diretório"
  532. #define ERR_DISK_FULL "Disco cheio"
  533. #define ERR_DIRECTORY_FULL "Diretório cheio"
  534. #define ERR_MACOS_GENERIC "MacOS reportou um erro (%d)"
  535. #define ERR_VOL_LOCKED_HW "Volume travado por hardware"
  536. #define ERR_VOL_LOCKED_SW "Volume travado por software"
  537. #define ERR_FILE_LOCKED "Arquivo travado"
  538. #define ERR_FILE_OR_DIR_BUSY "Arquivo/Diretório está em uso"
  539. #define ERR_FILE_ALREADY_OPEN_W "Arquivo já aberto para escrita"
  540. #define ERR_FILE_ALREADY_OPEN_R "Arquivo já aberto para leitura"
  541. #define ERR_INVALID_REFNUM "Número de referência"
  542. #define ERR_GETTING_FILE_POS "Erro ao tentar obter posição do arquivo"
  543. #define ERR_VOLUME_OFFLINE "Volume está indisponível"
  544. #define ERR_PERMISSION_DENIED "Permissão negada"
  545. #define ERR_VOL_ALREADY_ONLINE "Volume disponível"
  546. #define ERR_NO_SUCH_DRIVE "Drive inexistente"
  547. #define ERR_NOT_MAC_DISK "Não é um disco Macintosh"
  548. #define ERR_VOL_EXTERNAL_FS "Volume pertence a um sistema de arquivos externo"
  549. #define ERR_PROBLEM_RENAME "Problema durante renomeação"
  550. #define ERR_BAD_MASTER_BLOCK "Bloco master do diretório inválido"
  551. #define ERR_CANT_MOVE_FORBIDDEN "Tentativa de mover proibida"
  552. #define ERR_WRONG_VOL_TYPE "Tipo inválido de volume"
  553. #define ERR_SERVER_VOL_LOST "Volume servidor desconectado"
  554. #define ERR_FILE_ID_NOT_FOUND "ID de Arquivo não encontrado"
  555. #define ERR_FILE_ID_EXISTS "ID de Arquivo já existente"
  556. #define ERR_SERVER_NO_RESPOND "Servidor não respondendo"
  557. #define ERR_USER_AUTH_FAILED "Autenticação de usuário falhada"
  558. #define ERR_PWORD_EXPIRED "Password foi expirada no servidor"
  559. #define ERR_ACCESS_DENIED "Accesso negado"
  560. #define ERR_NOT_A_DOS_DISK "Não é um disco DOS"
  561. #define ERR_SHARING_VIOLATION "Violação de compartilhamento"
  562. #define ERR_CANNOT_MAKE "Não pode ser feito"
  563. #define ERR_DEV_IN_USE "Device já em uso"
  564. #define ERR_OPEN_FAILED "Falaha na abertura"
  565. #define ERR_PIPE_BUSY "Fila ocupada"
  566. #define ERR_SHARING_BUF_EXCEEDED "Buffer de compartilhamento excedeu"
  567. #define ERR_TOO_MANY_HANDLES "Muitos handles abertos"
  568. #define ERR_SEEK_ERROR "Erro de posicionamento"
  569. #define ERR_DEL_CWD "Tentando remover diretório de trabalho atual"
  570. #define ERR_WRITE_PROTECT_ERROR "Erro de proteção de escrita"
  571. #define ERR_WRITE_FAULT "Erro de escrita"
  572. #define ERR_LOCK_VIOLATION "Violação de trava"
  573. #define ERR_GEN_FAILURE "Falha geral"
  574. #define ERR_UNCERTAIN_MEDIA "Media incerta"
  575. #define ERR_PROT_VIOLATION "Violação de proteção"
  576. #define ERR_BROKEN_PIPE "Fila quebrada"
  577. #elif (PHYSFS_LANG == PHYSFS_LANG_SPANISH)
  578. #define DIR_ARCHIVE_DESCRIPTION "No es un archivo, E/S directa al sistema de ficheros"
  579. #define GRP_ARCHIVE_DESCRIPTION "Formato Build engine Groupfile"
  580. #define HOG_ARCHIVE_DESCRIPTION "Formato Descent I/II HOG file"
  581. #define MVL_ARCHIVE_DESCRIPTION "Formato Descent II Movielib"
  582. #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
  583. #define ZIP_ARCHIVE_DESCRIPTION "Compatible con PkZip/WinZip/Info-Zip"
  584. #define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" /* !!! FIXME: translate this line if needed */
  585. #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  586. #define ERR_IS_INITIALIZED "Ya estaba inicializado"
  587. #define ERR_NOT_INITIALIZED "No está inicializado"
  588. #define ERR_INVALID_ARGUMENT "Argumento inválido"
  589. #define ERR_FILES_STILL_OPEN "Archivos aún abiertos"
  590. #define ERR_NO_DIR_CREATE "Fallo al crear los directorios"
  591. #define ERR_OUT_OF_MEMORY "Memoria agotada"
  592. #define ERR_NOT_IN_SEARCH_PATH "No existe tal entrada en la ruta de búsqueda"
  593. #define ERR_NOT_SUPPORTED "Operación no soportada"
  594. #define ERR_UNSUPPORTED_ARCHIVE "Tipo de archivo no soportado"
  595. #define ERR_NOT_A_HANDLE "No es un manejador de ficheo (file handle)"
  596. #define ERR_INSECURE_FNAME "Nombre de archivo inseguro"
  597. #define ERR_SYMLINK_DISALLOWED "Los enlaces simbólicos están desactivados"
  598. #define ERR_NO_WRITE_DIR "No has configurado un directorio de escritura"
  599. #define ERR_NO_SUCH_FILE "Archivo no encontrado"
  600. #define ERR_NO_SUCH_PATH "Ruta no encontrada"
  601. #define ERR_NO_SUCH_VOLUME "Volumen no encontrado"
  602. #define ERR_PAST_EOF "Te pasaste del final del archivo"
  603. #define ERR_ARC_IS_READ_ONLY "El archivo es de sólo lectura"
  604. #define ERR_IO_ERROR "Error E/S"
  605. #define ERR_CANT_SET_WRITE_DIR "No puedo configurar el directorio de escritura"
  606. #define ERR_SYMLINK_LOOP "Bucle infnito de enlaces simbólicos"
  607. #define ERR_COMPRESSION "Error de (des)compresión"
  608. #define ERR_NOT_IMPLEMENTED "No implementado"
  609. #define ERR_OS_ERROR "El sistema operativo ha devuelto un error"
  610. #define ERR_FILE_EXISTS "El archivo ya existe"
  611. #define ERR_NOT_A_FILE "No es un archivo"
  612. #define ERR_NOT_A_DIR "No es un directorio"
  613. #define ERR_NOT_AN_ARCHIVE "No es un archivo"
  614. #define ERR_CORRUPTED "Archivo corrupto"
  615. #define ERR_SEEK_OUT_OF_RANGE "Búsqueda fuera de rango"
  616. #define ERR_BAD_FILENAME "Nombre de archivo incorrecto"
  617. #define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS ha hecho una llamada incorrecta al sistema"
  618. #define ERR_ARGV0_IS_NULL "argv0 es NULL"
  619. #define ERR_NEED_DICT "necesito diccionario"
  620. #define ERR_DATA_ERROR "error de datos"
  621. #define ERR_MEMORY_ERROR "error de memoria"
  622. #define ERR_BUFFER_ERROR "error de buffer"
  623. #define ERR_VERSION_ERROR "error de versión"
  624. #define ERR_UNKNOWN_ERROR "error desconocido"
  625. #define ERR_SEARCHPATH_TRUNC "La ruta de búsqueda ha sido truncada"
  626. #define ERR_GETMODFN_TRUNC "GetModuleFileName() ha sido truncado"
  627. #define ERR_GETMODFN_NO_DIR "GetModuleFileName() no tenia directorio"
  628. #define ERR_DISK_FULL "El disco está lleno"
  629. #define ERR_DIRECTORY_FULL "El directorio está lleno"
  630. #define ERR_MACOS_GENERIC "MacOS ha devuelto un error (%d)"
  631. #define ERR_VOL_LOCKED_HW "El volumen está bloqueado por el hardware"
  632. #define ERR_VOL_LOCKED_SW "El volumen está bloqueado por el software"
  633. #define ERR_FILE_LOCKED "El archivo está bloqueado"
  634. #define ERR_FILE_OR_DIR_BUSY "Fichero o directorio ocupados"
  635. #define ERR_FILE_ALREADY_OPEN_W "Fichero ya abierto para escritura"
  636. #define ERR_FILE_ALREADY_OPEN_R "Fichero ya abierto para lectura"
  637. #define ERR_INVALID_REFNUM "El número de referencia no es válido"
  638. #define ERR_GETTING_FILE_POS "Error al tomar la posición del fichero"
  639. #define ERR_VOLUME_OFFLINE "El volumen está desconectado"
  640. #define ERR_PERMISSION_DENIED "Permiso denegado"
  641. #define ERR_VOL_ALREADY_ONLINE "El volumen ya estaba conectado"
  642. #define ERR_NO_SUCH_DRIVE "No existe tal unidad"
  643. #define ERR_NOT_MAC_DISK "No es un disco Macintosh"
  644. #define ERR_VOL_EXTERNAL_FS "El volumen pertence a un sistema de ficheros externo"
  645. #define ERR_PROBLEM_RENAME "Problemas al renombrar"
  646. #define ERR_BAD_MASTER_BLOCK "Bloque maestro de directorios incorrecto"
  647. #define ERR_CANT_MOVE_FORBIDDEN "Intento de mover forbidden"
  648. #define ERR_WRONG_VOL_TYPE "Tipo de volumen incorrecto"
  649. #define ERR_SERVER_VOL_LOST "El servidor de volúmenes ha sido desconectado"
  650. #define ERR_FILE_ID_NOT_FOUND "Identificador de archivo no encontrado"
  651. #define ERR_FILE_ID_EXISTS "El identificador de archivo ya existe"
  652. #define ERR_SERVER_NO_RESPOND "El servidor no responde"
  653. #define ERR_USER_AUTH_FAILED "Fallo al autentificar el usuario"
  654. #define ERR_PWORD_EXPIRED "La Password en el servidor ha caducado"
  655. #define ERR_ACCESS_DENIED "Acceso denegado"
  656. #define ERR_NOT_A_DOS_DISK "No es un disco de DOS"
  657. #define ERR_SHARING_VIOLATION "Violación al compartir"
  658. #define ERR_CANNOT_MAKE "No puedo hacer make"
  659. #define ERR_DEV_IN_USE "El dispositivo ya estaba en uso"
  660. #define ERR_OPEN_FAILED "Fallo al abrir"
  661. #define ERR_PIPE_BUSY "Tubería ocupada"
  662. #define ERR_SHARING_BUF_EXCEEDED "Buffer de compartición sobrepasado"
  663. #define ERR_TOO_MANY_HANDLES "Demasiados manejadores (handles)"
  664. #define ERR_SEEK_ERROR "Error de búsqueda"
  665. #define ERR_DEL_CWD "Intentando borrar el directorio de trabajo actual"
  666. #define ERR_WRITE_PROTECT_ERROR "Error de protección contra escritura"
  667. #define ERR_WRITE_FAULT "Fallo al escribir"
  668. #define ERR_LOCK_VIOLATION "Violación del bloqueo"
  669. #define ERR_GEN_FAILURE "Fallo general"
  670. #define ERR_UNCERTAIN_MEDIA "Medio incierto"
  671. #define ERR_PROT_VIOLATION "Violación de la protección"
  672. #define ERR_BROKEN_PIPE "Tubería rota"
  673. #else
  674. #error Please define PHYSFS_LANG.
  675. #endif
  676. /* end LANG section. */
  677. /* !!! FIXME: find something better than "dvoid" and "fvoid" ... */
  678. /* Opaque data for file and dir handlers... */
  679. typedef void dvoid;
  680. typedef struct
  681. {
  682. /*
  683. * Basic info about this archiver...
  684. */
  685. const PHYSFS_ArchiveInfo *info;
  686. /*
  687. * DIRECTORY ROUTINES:
  688. * These functions are for dir handles. Generate a handle with the
  689. * openArchive() method, then pass it as the "opaque" dvoid to the
  690. * others.
  691. *
  692. * Symlinks should always be followed (except in stat()); PhysicsFS will
  693. * use the stat() method to check for symlinks and make a judgement on
  694. * whether to continue to call other methods based on that.
  695. */
  696. /*
  697. * Open a dirhandle for dir/archive data provided by (io).
  698. * (name) is a filename associated with (io), but doesn't necessarily
  699. * map to anything, let alone a real filename. This possibly-
  700. * meaningless name is in platform-dependent notation.
  701. * (forWriting) is non-zero if this is to be used for
  702. * the write directory, and zero if this is to be used for an
  703. * element of the search path.
  704. * Returns NULL on failure, and calls __PHYSFS_setError().
  705. * Returns non-NULL on success. The pointer returned will be
  706. * passed as the "opaque" parameter for later calls.
  707. */
  708. dvoid *(*openArchive)(PHYSFS_Io *io, const char *name, int forWriting);
  709. /*
  710. * List all files in (dirname). Each file is passed to (callback),
  711. * where a copy is made if appropriate, so you should dispose of
  712. * it properly upon return from the callback.
  713. * You should omit symlinks if (omitSymLinks) is non-zero.
  714. * If you have a failure, report as much as you can.
  715. * (dirname) is in platform-independent notation.
  716. */
  717. void (*enumerateFiles)(dvoid *opaque,
  718. const char *dirname,
  719. int omitSymLinks,
  720. PHYSFS_EnumFilesCallback callback,
  721. const char *origdir,
  722. void *callbackdata);
  723. /*
  724. * Open file for reading.
  725. * This filename is in platform-independent notation.
  726. * If you can't handle multiple opens of the same file,
  727. * you can opt to fail for the second call.
  728. * Fail if the file does not exist.
  729. * Returns NULL on failure, and calls __PHYSFS_setError().
  730. * Returns non-NULL on success. The pointer returned will be
  731. * passed as the "opaque" parameter for later file calls.
  732. *
  733. * Regardless of success or failure, please set *fileExists to
  734. * non-zero if the file existed (even if it's a broken symlink!),
  735. * zero if it did not.
  736. */
  737. PHYSFS_Io *(*openRead)(dvoid *opaque, const char *fname, int *fileExists);
  738. /*
  739. * Open file for writing.
  740. * If the file does not exist, it should be created. If it exists,
  741. * it should be truncated to zero bytes. The writing
  742. * offset should be the start of the file.
  743. * This filename is in platform-independent notation.
  744. * If you can't handle multiple opens of the same file,
  745. * you can opt to fail for the second call.
  746. * Returns NULL on failure, and calls __PHYSFS_setError().
  747. * Returns non-NULL on success. The pointer returned will be
  748. * passed as the "opaque" parameter for later file calls.
  749. */
  750. PHYSFS_Io *(*openWrite)(dvoid *opaque, const char *filename);
  751. /*
  752. * Open file for appending.
  753. * If the file does not exist, it should be created. The writing
  754. * offset should be the end of the file.
  755. * This filename is in platform-independent notation.
  756. * If you can't handle multiple opens of the same file,
  757. * you can opt to fail for the second call.
  758. * Returns NULL on failure, and calls __PHYSFS_setError().
  759. * Returns non-NULL on success. The pointer returned will be
  760. * passed as the "opaque" parameter for later file calls.
  761. */
  762. PHYSFS_Io *(*openAppend)(dvoid *opaque, const char *filename);
  763. /*
  764. * Delete a file in the archive/directory.
  765. * Return non-zero on success, zero on failure.
  766. * This filename is in platform-independent notation.
  767. * This method may be NULL.
  768. * On failure, call __PHYSFS_setError().
  769. */
  770. int (*remove)(dvoid *opaque, const char *filename);
  771. /*
  772. * Create a directory in the archive/directory.
  773. * If the application is trying to make multiple dirs, PhysicsFS
  774. * will split them up into multiple calls before passing them to
  775. * your driver.
  776. * Return non-zero on success, zero on failure.
  777. * This filename is in platform-independent notation.
  778. * This method may be NULL.
  779. * On failure, call __PHYSFS_setError().
  780. */
  781. int (*mkdir)(dvoid *opaque, const char *filename);
  782. /*
  783. * Close directories/archives, and free any associated memory,
  784. * including the original PHYSFS_Io and (opaque) itself, if
  785. * applicable. Implementation can assume that it won't be called if
  786. * there are still files open from this archive.
  787. */
  788. void (*dirClose)(dvoid *opaque);
  789. /*
  790. * Obtain basic file metadata.
  791. * Returns non-zero on success, zero on failure.
  792. * On failure, call __PHYSFS_setError().
  793. */
  794. int (*stat)(dvoid *opaque, const char *fn, int *exists, PHYSFS_Stat *stat);
  795. } PHYSFS_Archiver;
  796. /*
  797. * Call this to set the message returned by PHYSFS_getLastError().
  798. * Please only use the ERR_* constants above, or add new constants to the
  799. * above group, but I want these all in one place.
  800. *
  801. * Calling this with a NULL argument is a safe no-op.
  802. */
  803. void __PHYSFS_setError(const char *err);
  804. /* This byteorder stuff was lifted from SDL. http://www.libsdl.org/ */
  805. #define PHYSFS_LIL_ENDIAN 1234
  806. #define PHYSFS_BIG_ENDIAN 4321
  807. #if defined(__i386__) || defined(__ia64__) || \
  808. defined(_M_IX86) || defined(_M_IA64) || defined(_M_X64) || \
  809. (defined(__alpha__) || defined(__alpha)) || \
  810. defined(__arm__) || defined(ARM) || \
  811. (defined(__mips__) && defined(__MIPSEL__)) || \
  812. defined(__SYMBIAN32__) || \
  813. defined(__x86_64__) || \
  814. defined(__LITTLE_ENDIAN__)
  815. #define PHYSFS_BYTEORDER PHYSFS_LIL_ENDIAN
  816. #else
  817. #define PHYSFS_BYTEORDER PHYSFS_BIG_ENDIAN
  818. #endif
  819. /*
  820. * When sorting the entries in an archive, we use a modified QuickSort.
  821. * When there are less then PHYSFS_QUICKSORT_THRESHOLD entries left to sort,
  822. * we switch over to a BubbleSort for the remainder. Tweak to taste.
  823. *
  824. * You can override this setting by defining PHYSFS_QUICKSORT_THRESHOLD
  825. * before #including "physfs_internal.h".
  826. */
  827. #ifndef PHYSFS_QUICKSORT_THRESHOLD
  828. #define PHYSFS_QUICKSORT_THRESHOLD 4
  829. #endif
  830. /*
  831. * Sort an array (or whatever) of (max) elements. This uses a mixture of
  832. * a QuickSort and BubbleSort internally.
  833. * (cmpfn) is used to determine ordering, and (swapfn) does the actual
  834. * swapping of elements in the list.
  835. *
  836. * See zip.c for an example.
  837. */
  838. void __PHYSFS_sort(void *entries, PHYSFS_uint32 max,
  839. int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32),
  840. void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32));
  841. /* These get used all over for lessening code clutter. */
  842. #define BAIL_MACRO(e, r) do { __PHYSFS_setError(e); return r; } while (0)
  843. #define BAIL_IF_MACRO(c, e, r) do { if (c) { __PHYSFS_setError(e); return r; } } while (0)
  844. #define BAIL_MACRO_MUTEX(e, m, r) do { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; } while (0)
  845. #define BAIL_IF_MACRO_MUTEX(c, e, m, r) do { if (c) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; } } while (0)
  846. #define GOTO_MACRO(e, g) do { __PHYSFS_setError(e); goto g; } while (0)
  847. #define GOTO_IF_MACRO(c, e, g) do { if (c) { __PHYSFS_setError(e); goto g; } } while (0)
  848. #define GOTO_MACRO_MUTEX(e, m, g) do { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); goto g; } while (0)
  849. #define GOTO_IF_MACRO_MUTEX(c, e, m, g) do { if (c) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); goto g; } } while (0)
  850. #define __PHYSFS_ARRAYLEN(x) ( (sizeof (x)) / (sizeof (x[0])) )
  851. #ifdef PHYSFS_NO_64BIT_SUPPORT
  852. #define __PHYSFS_SI64(x) ((PHYSFS_sint64) (x))
  853. #define __PHYSFS_UI64(x) ((PHYSFS_uint64) (x))
  854. #elif (defined __GNUC__)
  855. #define __PHYSFS_SI64(x) x##LL
  856. #define __PHYSFS_UI64(x) x##ULL
  857. #elif (defined _MSC_VER)
  858. #define __PHYSFS_SI64(x) x##i64
  859. #define __PHYSFS_UI64(x) x##ui64
  860. #else
  861. #define __PHYSFS_SI64(x) ((PHYSFS_sint64) (x))
  862. #define __PHYSFS_UI64(x) ((PHYSFS_uint64) (x))
  863. #endif
  864. /*
  865. * Check if a ui64 will fit in the platform's address space.
  866. * The initial sizeof check will optimize this macro out entirely on
  867. * 64-bit (and larger?!) platforms, and the other condition will
  868. * return zero or non-zero if the variable will fit in the platform's
  869. * size_t, suitable to pass to malloc. This is kinda messy, but effective.
  870. */
  871. #define __PHYSFS_ui64FitsAddressSpace(s) ( \
  872. (sizeof (PHYSFS_uint64) <= sizeof (size_t)) || \
  873. ((s) < (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \
  874. )
  875. /*
  876. * This is a strcasecmp() or stricmp() replacement that expects both strings
  877. * to be in UTF-8 encoding. It will do "case folding" to decide if the
  878. * Unicode codepoints in the strings match.
  879. *
  880. * It will report which string is "greater than" the other, but be aware that
  881. * this doesn't necessarily mean anything: 'a' may be "less than" 'b', but
  882. * a random Kanji codepoint has no meaningful alphabetically relationship to
  883. * a Greek Lambda, but being able to assign a reliable "value" makes sorting
  884. * algorithms possible, if not entirely sane. Most cases should treat the
  885. * return value as "equal" or "not equal".
  886. */
  887. /* !!! FIXME: why is this casecmp, when everyone else is icmp? */
  888. int __PHYSFS_utf8strcasecmp(const char *s1, const char *s2);
  889. /*
  890. * This works like __PHYSFS_utf8strcasecmp(), but takes a character (NOT BYTE
  891. * COUNT) argument, like strcasencmp().
  892. */
  893. int __PHYSFS_utf8strnicmp(const char *s1, const char *s2, PHYSFS_uint32 l);
  894. /*
  895. * stricmp() that guarantees to only work with low ASCII. The C runtime
  896. * stricmp() might try to apply a locale/codepage/etc, which we don't want.
  897. */
  898. int __PHYSFS_stricmpASCII(const char *s1, const char *s2);
  899. /*
  900. * strnicmp() that guarantees to only work with low ASCII. The C runtime
  901. * strnicmp() might try to apply a locale/codepage/etc, which we don't want.
  902. */
  903. int __PHYSFS_strnicmpASCII(const char *s1, const char *s2, PHYSFS_uint32 l);
  904. /*
  905. * The current allocator. Not valid before PHYSFS_init is called!
  906. */
  907. extern PHYSFS_Allocator __PHYSFS_AllocatorHooks;
  908. /* convenience macro to make this less cumbersome internally... */
  909. #define allocator __PHYSFS_AllocatorHooks
  910. /*
  911. * Create a PHYSFS_Io for a file in the physical filesystem.
  912. * This path is in platform-dependent notation. (mode) must be 'r', 'w', or
  913. * 'a' for Read, Write, or Append.
  914. */
  915. PHYSFS_Io *__PHYSFS_createNativeIo(const char *path, const int mode);
  916. /*
  917. * Create a PHYSFS_Io for a buffer of memory (READ-ONLY). If you already
  918. * have one of these, just use its duplicate() method, and it'll increment
  919. * its refcount without allocating a copy of the buffer.
  920. */
  921. PHYSFS_Io *__PHYSFS_createMemoryIo(const void *buf, PHYSFS_uint64 len,
  922. void (*destruct)(void *));
  923. /*
  924. * Read (len) bytes from (io) into (buf). Returns non-zero on success,
  925. * zero on i/o error. Literally: "return (io->read(io, buf, len) == len);"
  926. */
  927. int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const PHYSFS_uint64 len);
  928. /* These are shared between some archivers. */
  929. typedef struct
  930. {
  931. char name[32];
  932. PHYSFS_uint32 startPos;
  933. PHYSFS_uint32 size;
  934. } UNPKentry;
  935. void UNPK_dirClose(dvoid *opaque);
  936. dvoid *UNPK_openArchive(PHYSFS_Io *io, UNPKentry *e, const PHYSFS_uint32 num);
  937. void UNPK_enumerateFiles(dvoid *opaque, const char *dname,
  938. int omitSymLinks, PHYSFS_EnumFilesCallback cb,
  939. const char *origdir, void *callbackdata);
  940. PHYSFS_Io *UNPK_openRead(dvoid *opaque, const char *fnm, int *fileExists);
  941. PHYSFS_Io *UNPK_openWrite(dvoid *opaque, const char *name);
  942. PHYSFS_Io *UNPK_openAppend(dvoid *opaque, const char *name);
  943. int UNPK_remove(dvoid *opaque, const char *name);
  944. int UNPK_mkdir(dvoid *opaque, const char *name);
  945. int UNPK_stat(dvoid *opaque, const char *fn, int *exists, PHYSFS_Stat *stat);
  946. /*--------------------------------------------------------------------------*/
  947. /*--------------------------------------------------------------------------*/
  948. /*------------ ----------------*/
  949. /*------------ You MUST implement the following functions ----------------*/
  950. /*------------ if porting to a new platform. ----------------*/
  951. /*------------ (see platform/unix.c for an example) ----------------*/
  952. /*------------ ----------------*/
  953. /*--------------------------------------------------------------------------*/
  954. /*--------------------------------------------------------------------------*/
  955. /*
  956. * The dir separator; '/' on unix, '\\' on win32, ":" on MacOS, etc...
  957. * Obviously, this isn't a function. If you need more than one char for this,
  958. * you'll need to pull some old pieces of PhysicsFS out of revision control.
  959. */
  960. #if PHYSFS_PLATFORM_WINDOWS
  961. #define __PHYSFS_platformDirSeparator '\\'
  962. #else
  963. #define __PHYSFS_platformDirSeparator '/'
  964. #endif
  965. /*
  966. * Initialize the platform. This is called when PHYSFS_init() is called from
  967. * the application.
  968. *
  969. * Return zero if there was a catastrophic failure (which prevents you from
  970. * functioning at all), and non-zero otherwise.
  971. */
  972. int __PHYSFS_platformInit(void);
  973. /*
  974. * Deinitialize the platform. This is called when PHYSFS_deinit() is called
  975. * from the application. You can use this to clean up anything you've
  976. * allocated in your platform driver.
  977. *
  978. * Return zero if there was a catastrophic failure (which prevents you from
  979. * functioning at all), and non-zero otherwise.
  980. */
  981. int __PHYSFS_platformDeinit(void);
  982. /*
  983. * Open a file for reading. (filename) is in platform-dependent notation. The
  984. * file pointer should be positioned on the first byte of the file.
  985. *
  986. * The return value will be some platform-specific datatype that is opaque to
  987. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32.
  988. *
  989. * The same file can be opened for read multiple times, and each should have
  990. * a unique file handle; this is frequently employed to prevent race
  991. * conditions in the archivers.
  992. *
  993. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  994. */
  995. void *__PHYSFS_platformOpenRead(const char *filename);
  996. /*
  997. * Open a file for writing. (filename) is in platform-dependent notation. If
  998. * the file exists, it should be truncated to zero bytes, and if it doesn't
  999. * exist, it should be created as a zero-byte file. The file pointer should
  1000. * be positioned on the first byte of the file.
  1001. *
  1002. * The return value will be some platform-specific datatype that is opaque to
  1003. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32,
  1004. * etc.
  1005. *
  1006. * Opening a file for write multiple times has undefined results.
  1007. *
  1008. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  1009. */
  1010. void *__PHYSFS_platformOpenWrite(const char *filename);
  1011. /*
  1012. * Open a file for appending. (filename) is in platform-dependent notation. If
  1013. * the file exists, the file pointer should be place just past the end of the
  1014. * file, so that the first write will be one byte after the current end of
  1015. * the file. If the file doesn't exist, it should be created as a zero-byte
  1016. * file. The file pointer should be positioned on the first byte of the file.
  1017. *
  1018. * The return value will be some platform-specific datatype that is opaque to
  1019. * the caller; it could be a (FILE *) under Unix, or a (HANDLE *) under win32,
  1020. * etc.
  1021. *
  1022. * Opening a file for append multiple times has undefined results.
  1023. *
  1024. * Call __PHYSFS_setError() and return (NULL) if the file can't be opened.
  1025. */
  1026. void *__PHYSFS_platformOpenAppend(const char *filename);
  1027. /*
  1028. * Read more data from a platform-specific file handle. (opaque) should be
  1029. * cast to whatever data type your platform uses. Read a maximum of (len)
  1030. * 8-bit bytes to the area pointed to by (buf). If there isn't enough data
  1031. * available, return the number of bytes read, and position the file pointer
  1032. * immediately after those bytes.
  1033. * On success, return (len) and position the file pointer immediately past
  1034. * the end of the last read byte. Return (-1) if there is a catastrophic
  1035. * error, and call __PHYSFS_setError() to describe the problem; the file
  1036. * pointer should not move in such a case. A partial read is success; only
  1037. * return (-1) on total failure; presumably, the next read call after a
  1038. * partial read will fail as such.
  1039. */
  1040. PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len);
  1041. /*
  1042. * Write more data to a platform-specific file handle. (opaque) should be
  1043. * cast to whatever data type your platform uses. Write a maximum of (len)
  1044. * 8-bit bytes from the area pointed to by (buffer). If there is a problem,
  1045. * return the number of bytes written, and position the file pointer
  1046. * immediately after those bytes. Return (-1) if there is a catastrophic
  1047. * error, and call __PHYSFS_setError() to describe the problem; the file
  1048. * pointer should not move in such a case. A partial write is success; only
  1049. * return (-1) on total failure; presumably, the next write call after a
  1050. * partial write will fail as such.
  1051. */
  1052. PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
  1053. PHYSFS_uint64 len);
  1054. /*
  1055. * Set the file pointer to a new position. (opaque) should be cast to
  1056. * whatever data type your platform uses. (pos) specifies the number
  1057. * of 8-bit bytes to seek to from the start of the file. Seeking past the
  1058. * end of the file is an error condition, and you should check for it.
  1059. *
  1060. * Not all file types can seek; this is to be expected by the caller.
  1061. *
  1062. * On error, call __PHYSFS_setError() and return zero. On success, return
  1063. * a non-zero value.
  1064. */
  1065. int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos);
  1066. /*
  1067. * Get the file pointer's position, in an 8-bit byte offset from the start of
  1068. * the file. (opaque) should be cast to whatever data type your platform
  1069. * uses.
  1070. *
  1071. * Not all file types can "tell"; this is to be expected by the caller.
  1072. *
  1073. * On error, call __PHYSFS_setError() and return -1. On success, return >= 0.
  1074. */
  1075. PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);
  1076. /*
  1077. * Determine the current size of a file, in 8-bit bytes, from an open file.
  1078. *
  1079. * The caller expects that this information may not be available for all
  1080. * file types on all platforms.
  1081. *
  1082. * Return -1 if you can't do it, and call __PHYSFS_setError(). Otherwise,
  1083. * return the file length in 8-bit bytes.
  1084. */
  1085. PHYSFS_sint64 __PHYSFS_platformFileLength(void *handle);
  1086. /*
  1087. * !!! FIXME: comment me.
  1088. */
  1089. int __PHYSFS_platformStat(const char *fn, int *exists, PHYSFS_Stat *stat);
  1090. /*
  1091. * Flush any pending writes to disk. (opaque) should be cast to whatever data
  1092. * type your platform uses. Be sure to check for errors; the caller expects
  1093. * that this function can fail if there was a flushing error, etc.
  1094. *
  1095. * Return zero on failure, non-zero on success.
  1096. */
  1097. int __PHYSFS_platformFlush(void *opaque);
  1098. /*
  1099. * Close file and deallocate resources. (opaque) should be cast to whatever
  1100. * data type your platform uses. This should close the file in any scenario:
  1101. * flushing is a separate function call, and this function should never fail.
  1102. *
  1103. * You should clean up all resources associated with (opaque); the pointer
  1104. * will be considered invalid after this call.
  1105. */
  1106. void __PHYSFS_platformClose(void *opaque);
  1107. /*
  1108. * Platform implementation of PHYSFS_getCdRomDirsCallback()...
  1109. * CD directories are discovered and reported to the callback one at a time.
  1110. * Pointers passed to the callback are assumed to be invalid to the
  1111. * application after the callback returns, so you can free them or whatever.
  1112. * Callback does not assume results will be sorted in any meaningful way.
  1113. */
  1114. void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data);
  1115. /*
  1116. * Calculate the base dir, if your platform needs special consideration.
  1117. * Just return NULL if the standard routines will suffice. (see
  1118. * calculateBaseDir() in physfs.c ...)
  1119. * Caller will allocator.Free() the retval if it's not NULL.
  1120. */
  1121. char *__PHYSFS_platformCalcBaseDir(const char *argv0);
  1122. /*
  1123. * Get the platform-specific user name.
  1124. * Caller will allocator.Free() the retval if it's not NULL. If it's NULL,
  1125. * the username will default to "default".
  1126. */
  1127. char *__PHYSFS_platformGetUserName(void);
  1128. /*
  1129. * Get the platform-specific user dir.
  1130. * Caller will allocator.Free() the retval if it's not NULL. If it's NULL,
  1131. * the userdir will default to basedir/username.
  1132. */
  1133. char *__PHYSFS_platformGetUserDir(void);
  1134. /*
  1135. * Return a pointer that uniquely identifies the current thread.
  1136. * On a platform without threading, (0x1) will suffice. These numbers are
  1137. * arbitrary; the only requirement is that no two threads have the same
  1138. * pointer.
  1139. */
  1140. void *__PHYSFS_platformGetThreadID(void);
  1141. /*
  1142. * Enumerate a directory of files. This follows the rules for the
  1143. * PHYSFS_Archiver->enumerateFiles() method (see above), except that the
  1144. * (dirName) that is passed to this function is converted to
  1145. * platform-DEPENDENT notation by the caller. The PHYSFS_Archiver version
  1146. * uses platform-independent notation. Note that ".", "..", and other
  1147. * metaentries should always be ignored.
  1148. */
  1149. void __PHYSFS_platformEnumerateFiles(const char *dirname,
  1150. int omitSymLinks,
  1151. PHYSFS_EnumFilesCallback callback,
  1152. const char *origdir,
  1153. void *callbackdata);
  1154. /*
  1155. * Make a directory in the actual filesystem. (path) is specified in
  1156. * platform-dependent notation. On error, return zero and set the error
  1157. * message. Return non-zero on success.
  1158. */
  1159. int __PHYSFS_platformMkDir(const char *path);
  1160. /*
  1161. * Remove a file or directory entry in the actual filesystem. (path) is
  1162. * specified in platform-dependent notation. Note that this deletes files
  1163. * _and_ directories, so you might need to do some determination.
  1164. * Non-empty directories should report an error and not delete themselves
  1165. * or their contents.
  1166. *
  1167. * Deleting a symlink should remove the link, not what it points to.
  1168. *
  1169. * On error, return zero and set the error message. Return non-zero on success.
  1170. */
  1171. int __PHYSFS_platformDelete(const char *path);
  1172. /*
  1173. * Create a platform-specific mutex. This can be whatever datatype your
  1174. * platform uses for mutexes, but it is cast to a (void *) for abstractness.
  1175. *
  1176. * Return (NULL) if you couldn't create one. Systems without threads can
  1177. * return any arbitrary non-NULL value.
  1178. */
  1179. void *__PHYSFS_platformCreateMutex(void);
  1180. /*
  1181. * Destroy a platform-specific mutex, and clean up any resources associated
  1182. * with it. (mutex) is a value previously returned by
  1183. * __PHYSFS_platformCreateMutex(). This can be a no-op on single-threaded
  1184. * platforms.
  1185. */
  1186. void __PHYSFS_platformDestroyMutex(void *mutex);
  1187. /*
  1188. * Grab possession of a platform-specific mutex. Mutexes should be recursive;
  1189. * that is, the same thread should be able to call this function multiple
  1190. * times in a row without causing a deadlock. This function should block
  1191. * until a thread can gain possession of the mutex.
  1192. *
  1193. * Return non-zero if the mutex was grabbed, zero if there was an
  1194. * unrecoverable problem grabbing it (this should not be a matter of
  1195. * timing out! We're talking major system errors; block until the mutex
  1196. * is available otherwise.)
  1197. *
  1198. * _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
  1199. * function, you'll cause an infinite recursion. This means you can't
  1200. * use the BAIL_*MACRO* macros, either.
  1201. */
  1202. int __PHYSFS_platformGrabMutex(void *mutex);
  1203. /*
  1204. * Relinquish possession of the mutex when this method has been called
  1205. * once for each time that platformGrabMutex was called. Once possession has
  1206. * been released, the next thread in line to grab the mutex (if any) may
  1207. * proceed.
  1208. *
  1209. * _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
  1210. * function, you'll cause an infinite recursion. This means you can't
  1211. * use the BAIL_*MACRO* macros, either.
  1212. */
  1213. void __PHYSFS_platformReleaseMutex(void *mutex);
  1214. /*
  1215. * Called at the start of PHYSFS_init() to prepare the allocator, if the user
  1216. * hasn't selected their own allocator via PHYSFS_setAllocator().
  1217. * If the platform has a custom allocator, it should fill in the fields of
  1218. * (a) with the proper function pointers and return non-zero.
  1219. * If the platform just wants to use malloc()/free()/etc, return zero
  1220. * immediately and the higher level will handle it. The Init and Deinit
  1221. * fields of (a) are optional...set them to NULL if you don't need them.
  1222. * Everything else must be implemented. All rules follow those for
  1223. * PHYSFS_setAllocator(). If Init isn't NULL, it will be called shortly
  1224. * after this function returns non-zero.
  1225. */
  1226. int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a);
  1227. #ifdef __cplusplus
  1228. }
  1229. #endif
  1230. #endif
  1231. /* end of physfs_internal.h ... */