physfs_internal.h 67 KB

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