physfs  2.0.3
physfs.h
Go to the documentation of this file.
1 
216 #ifndef _INCLUDE_PHYSFS_H_
217 #define _INCLUDE_PHYSFS_H_
218 
219 #ifdef __cplusplus
220 extern "C" {
221 #endif
222 
223 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
224 #if (defined _MSC_VER)
225 #define __EXPORT__ __declspec(dllexport)
226 #elif (__GNUC__ >= 3)
227 #define __EXPORT__ __attribute__((visibility("default")))
228 #else
229 #define __EXPORT__
230 #endif
231 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
232 
237 typedef unsigned char PHYSFS_uint8;
238 
243 typedef signed char PHYSFS_sint8;
244 
249 typedef unsigned short PHYSFS_uint16;
250 
255 typedef signed short PHYSFS_sint16;
256 
261 typedef unsigned int PHYSFS_uint32;
262 
267 typedef signed int PHYSFS_sint32;
268 
284 #if (defined PHYSFS_NO_64BIT_SUPPORT) /* oh well. */
285 typedef PHYSFS_uint32 PHYSFS_uint64;
286 typedef PHYSFS_sint32 PHYSFS_sint64;
287 #elif (defined _MSC_VER)
288 typedef signed __int64 PHYSFS_sint64;
289 typedef unsigned __int64 PHYSFS_uint64;
290 #else
291 typedef unsigned long long PHYSFS_uint64;
292 typedef signed long long PHYSFS_sint64;
293 #endif
294 
295 
296 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
297 /* Make sure the types really have the right sizes */
298 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
299  typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
300 
301 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
302 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
303 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
304 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
305 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
306 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
307 
308 #ifndef PHYSFS_NO_64BIT_SUPPORT
309 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
310 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
311 #endif
312 
313 #undef PHYSFS_COMPILE_TIME_ASSERT
314 
315 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
316 
317 
341 typedef struct PHYSFS_File
342 {
343  void *opaque;
344 } PHYSFS_File;
345 
346 
358 #define PHYSFS_file PHYSFS_File
359 
360 
376 typedef struct PHYSFS_ArchiveInfo
377 {
378  const char *extension;
379  const char *description;
380  const char *author;
381  const char *url;
383 
384 
398 typedef struct PHYSFS_Version
399 {
400  PHYSFS_uint8 major;
401  PHYSFS_uint8 minor;
402  PHYSFS_uint8 patch;
404 
405 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
406 #define PHYSFS_VER_MAJOR 2
407 #define PHYSFS_VER_MINOR 0
408 #define PHYSFS_VER_PATCH 3
409 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
410 
411 
412 /* PhysicsFS state stuff ... */
413 
430 #define PHYSFS_VERSION(x) \
431 { \
432  (x)->major = PHYSFS_VER_MAJOR; \
433  (x)->minor = PHYSFS_VER_MINOR; \
434  (x)->patch = PHYSFS_VER_PATCH; \
435 }
436 
437 
464 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
465 
466 
487 __EXPORT__ int PHYSFS_init(const char *argv0);
488 
489 
516 __EXPORT__ int PHYSFS_deinit(void);
517 
518 
547 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
548 
549 
563 __EXPORT__ void PHYSFS_freeList(void *listVar);
564 
565 
584 __EXPORT__ const char *PHYSFS_getLastError(void);
585 
586 
600 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
601 
602 
633 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
634 
635 
636 /* !!! FIXME: const this? */
676 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
677 
678 
695 __EXPORT__ const char *PHYSFS_getBaseDir(void);
696 
697 
718 __EXPORT__ const char *PHYSFS_getUserDir(void);
719 
720 
732 __EXPORT__ const char *PHYSFS_getWriteDir(void);
733 
734 
754 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
755 
756 
771 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
772 
773 
791 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
792 
793 
820 __EXPORT__ char **PHYSFS_getSearchPath(void);
821 
822 
880 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
881  const char *appName,
882  const char *archiveExt,
883  int includeCdRoms,
884  int archivesFirst);
885 
886 
887 /* Directory management stuff ... */
888 
910 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
911 
912 
943 __EXPORT__ int PHYSFS_delete(const char *filename);
944 
945 
971 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
972 
973 
1012 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
1013 
1014 
1032 __EXPORT__ int PHYSFS_exists(const char *fname);
1033 
1034 
1052 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
1053 
1054 
1072 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
1073 
1074 
1088 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
1089 
1090 
1091 /* i/o stuff... */
1092 
1115 __EXPORT__ PHYSFS_File *PHYSFS_openWrite(const char *filename);
1116 
1117 
1141 __EXPORT__ PHYSFS_File *PHYSFS_openAppend(const char *filename);
1142 
1143 
1166 __EXPORT__ PHYSFS_File *PHYSFS_openRead(const char *filename);
1167 
1168 
1187 __EXPORT__ int PHYSFS_close(PHYSFS_File *handle);
1188 
1189 
1206 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
1207  void *buffer,
1208  PHYSFS_uint32 objSize,
1209  PHYSFS_uint32 objCount);
1210 
1224 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
1225  const void *buffer,
1226  PHYSFS_uint32 objSize,
1227  PHYSFS_uint32 objCount);
1228 
1229 
1230 /* File position stuff... */
1231 
1244 __EXPORT__ int PHYSFS_eof(PHYSFS_File *handle);
1245 
1246 
1257 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
1258 
1259 
1274 __EXPORT__ int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
1275 
1276 
1293 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
1294 
1295 
1296 /* Buffering stuff... */
1297 
1338 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
1339 
1340 
1357 __EXPORT__ int PHYSFS_flush(PHYSFS_File *handle);
1358 
1359 
1360 /* Byteorder stuff... */
1361 
1372 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
1373 
1374 
1385 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
1386 
1397 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
1398 
1399 
1410 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
1411 
1425 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
1426 
1427 
1441 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
1442 
1443 
1454 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
1455 
1456 
1467 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
1468 
1479 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
1480 
1481 
1492 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
1493 
1494 
1508 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
1509 
1510 
1524 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
1525 
1526 
1540 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
1541 
1542 
1557 __EXPORT__ int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
1558 
1559 
1573 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
1574 
1575 
1590 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
1591 
1592 
1606 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
1607 
1608 
1623 __EXPORT__ int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
1624 
1625 
1639 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
1640 
1641 
1656 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
1657 
1658 
1675 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
1676 
1677 
1694 __EXPORT__ int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
1695 
1696 
1713 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
1714 
1715 
1732 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
1733 
1734 
1747 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
1748 
1749 
1762 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
1763 
1764 
1777 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
1778 
1779 
1792 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
1793 
1794 
1807 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
1808 
1809 
1822 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
1823 
1824 
1837 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
1838 
1839 
1852 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
1853 
1854 
1870 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
1871 
1872 
1888 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
1889 
1890 
1906 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
1907 
1908 
1924 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
1925 
1926 
1927 /* Everything above this line is part of the PhysicsFS 1.0 API. */
1928 
1943 __EXPORT__ int PHYSFS_isInit(void);
1944 
1945 
1958 __EXPORT__ int PHYSFS_symbolicLinksPermitted(void);
1959 
1960 
1981 typedef struct PHYSFS_Allocator
1982 {
1983  int (*Init)(void);
1984  void (*Deinit)(void);
1985  void *(*Malloc)(PHYSFS_uint64);
1986  void *(*Realloc)(void *, PHYSFS_uint64);
1987  void (*Free)(void *);
1989 
1990 
2018 __EXPORT__ int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
2019 
2020 
2061 __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);
2062 
2085 __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir);
2086 
2087 
2112 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
2113 
2114 
2146 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
2147  const char *fname);
2148 
2149 
2181 __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
2182 
2183 
2217 __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
2218 
2219 
2258 __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
2260  void *d);
2261 
2281 __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
2282  PHYSFS_uint64 len);
2283 
2303 __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
2304  PHYSFS_uint64 len);
2305 
2329 __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
2330  PHYSFS_uint64 len);
2331 
2355 __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
2356  PHYSFS_uint64 len);
2357 
2382 __EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst,
2383  PHYSFS_uint64 len);
2384 
2385 /* Everything above this line is part of the PhysicsFS 2.0 API. */
2386 
2387 
2388 #ifdef __cplusplus
2389 }
2390 #endif
2391 
2392 #endif /* !defined _INCLUDE_PHYSFS_H_ */
2393 
2394 /* end of physfs.h ... */
2395