physfs_internal.h 71 KB

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