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