1
0

physfs_internal.h 71 KB

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