physfs 1.0.2
|
00001 00146 #ifndef _INCLUDE_PHYSFS_H_ 00147 #define _INCLUDE_PHYSFS_H_ 00148 00149 #ifdef __cplusplus 00150 extern "C" { 00151 #endif 00152 00153 #ifndef DOXYGEN_SHOULD_IGNORE_THIS 00154 #if (defined _MSC_VER) 00155 #define __EXPORT__ __declspec(dllexport) 00156 #elif (__GNUC__ >= 3) 00157 #define __EXPORT__ __attribute__((visibility("default"))) 00158 #else 00159 #define __EXPORT__ 00160 #endif 00161 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ 00162 00167 typedef unsigned char PHYSFS_uint8; 00168 00173 typedef signed char PHYSFS_sint8; 00174 00179 typedef unsigned short PHYSFS_uint16; 00180 00185 typedef signed short PHYSFS_sint16; 00186 00191 typedef unsigned int PHYSFS_uint32; 00192 00197 typedef signed int PHYSFS_sint32; 00198 00214 #if (defined PHYSFS_NO_64BIT_SUPPORT) /* oh well. */ 00215 typedef PHYSFS_uint32 PHYSFS_uint64; 00216 typedef PHYSFS_sint32 PHYSFS_sint64; 00217 #elif (defined _MSC_VER) 00218 typedef signed __int64 PHYSFS_sint64; 00219 typedef unsigned __int64 PHYSFS_uint64; 00220 #else 00221 typedef unsigned long long PHYSFS_uint64; 00222 typedef signed long long PHYSFS_sint64; 00223 #endif 00224 00225 00226 #ifndef DOXYGEN_SHOULD_IGNORE_THIS 00227 /* Make sure the types really have the right sizes */ 00228 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \ 00229 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1] 00230 00231 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1); 00232 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1); 00233 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2); 00234 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2); 00235 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4); 00236 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4); 00237 00238 #ifndef PHYSFS_NO_64BIT_SUPPORT 00239 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8); 00240 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8); 00241 #endif 00242 00243 #undef PHYSFS_COMPILE_TIME_ASSERT 00244 00245 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ 00246 00247 00271 typedef struct 00272 { 00273 void *opaque; 00274 } PHYSFS_File; 00275 00276 typedef PHYSFS_File PHYSFS_file; /* for backwards compatibility with 1.0 */ 00277 00278 00294 typedef struct 00295 { 00296 const char *extension; 00297 const char *description; 00298 const char *author; 00299 const char *url; 00300 } PHYSFS_ArchiveInfo; 00301 00302 00316 typedef struct 00317 { 00318 PHYSFS_uint8 major; 00319 PHYSFS_uint8 minor; 00320 PHYSFS_uint8 patch; 00321 } PHYSFS_Version; 00322 00323 #ifndef DOXYGEN_SHOULD_IGNORE_THIS 00324 #define PHYSFS_VER_MAJOR 1 00325 #define PHYSFS_VER_MINOR 0 00326 #define PHYSFS_VER_PATCH 2 00327 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ 00328 00329 00330 /* PhysicsFS state stuff ... */ 00331 00348 #define PHYSFS_VERSION(x) \ 00349 { \ 00350 (x)->major = PHYSFS_VER_MAJOR; \ 00351 (x)->minor = PHYSFS_VER_MINOR; \ 00352 (x)->patch = PHYSFS_VER_PATCH; \ 00353 } 00354 00355 00382 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver); 00383 00384 00404 __EXPORT__ int PHYSFS_init(const char *argv0); 00405 00406 00431 __EXPORT__ int PHYSFS_deinit(void); 00432 00433 00462 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void); 00463 00464 00478 __EXPORT__ void PHYSFS_freeList(void *listVar); 00479 00480 00495 __EXPORT__ const char *PHYSFS_getLastError(void); 00496 00497 00511 __EXPORT__ const char *PHYSFS_getDirSeparator(void); 00512 00513 00542 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow); 00543 00544 00577 __EXPORT__ char **PHYSFS_getCdRomDirs(void); 00578 00579 00596 __EXPORT__ const char *PHYSFS_getBaseDir(void); 00597 00598 00619 __EXPORT__ const char *PHYSFS_getUserDir(void); 00620 00621 00633 __EXPORT__ const char *PHYSFS_getWriteDir(void); 00634 00635 00655 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir); 00656 00657 00675 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath); 00676 00677 00695 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir); 00696 00697 00723 __EXPORT__ char **PHYSFS_getSearchPath(void); 00724 00725 00783 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization, 00784 const char *appName, 00785 const char *archiveExt, 00786 int includeCdRoms, 00787 int archivesFirst); 00788 00789 00790 /* Directory management stuff ... */ 00791 00813 __EXPORT__ int PHYSFS_mkdir(const char *dirName); 00814 00815 00846 __EXPORT__ int PHYSFS_delete(const char *filename); 00847 00848 00870 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename); 00871 00872 00909 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir); 00910 00911 00929 __EXPORT__ int PHYSFS_exists(const char *fname); 00930 00931 00949 __EXPORT__ int PHYSFS_isDirectory(const char *fname); 00950 00951 00969 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname); 00970 00971 00985 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename); 00986 00987 00988 /* i/o stuff... */ 00989 01012 __EXPORT__ PHYSFS_file *PHYSFS_openWrite(const char *filename); 01013 01014 01038 __EXPORT__ PHYSFS_file *PHYSFS_openAppend(const char *filename); 01039 01040 01063 __EXPORT__ PHYSFS_file *PHYSFS_openRead(const char *filename); 01064 01065 01084 __EXPORT__ int PHYSFS_close(PHYSFS_file *handle); 01085 01086 01103 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, 01104 void *buffer, 01105 PHYSFS_uint32 objSize, 01106 PHYSFS_uint32 objCount); 01107 01121 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, 01122 const void *buffer, 01123 PHYSFS_uint32 objSize, 01124 PHYSFS_uint32 objCount); 01125 01126 01127 /* File position stuff... */ 01128 01141 __EXPORT__ int PHYSFS_eof(PHYSFS_file *handle); 01142 01143 01154 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_file *handle); 01155 01156 01171 __EXPORT__ int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos); 01172 01173 01190 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_file *handle); 01191 01192 01193 /* Buffering stuff... */ 01194 01235 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 bufsize); 01236 01237 01254 __EXPORT__ int PHYSFS_flush(PHYSFS_file *handle); 01255 01256 01257 /* Byteorder stuff... */ 01258 01269 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val); 01270 01271 01282 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val); 01283 01294 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val); 01295 01296 01307 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val); 01308 01322 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val); 01323 01324 01338 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val); 01339 01340 01351 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val); 01352 01353 01364 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val); 01365 01376 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val); 01377 01378 01389 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val); 01390 01391 01405 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val); 01406 01407 01421 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val); 01422 01423 01437 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_file *file, PHYSFS_sint16 *val); 01438 01439 01454 __EXPORT__ int PHYSFS_readULE16(PHYSFS_file *file, PHYSFS_uint16 *val); 01455 01456 01470 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_file *file, PHYSFS_sint16 *val); 01471 01472 01487 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_file *file, PHYSFS_uint16 *val); 01488 01489 01503 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_file *file, PHYSFS_sint32 *val); 01504 01505 01520 __EXPORT__ int PHYSFS_readULE32(PHYSFS_file *file, PHYSFS_uint32 *val); 01521 01522 01536 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_file *file, PHYSFS_sint32 *val); 01537 01538 01553 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_file *file, PHYSFS_uint32 *val); 01554 01555 01572 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_file *file, PHYSFS_sint64 *val); 01573 01574 01591 __EXPORT__ int PHYSFS_readULE64(PHYSFS_file *file, PHYSFS_uint64 *val); 01592 01593 01610 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_file *file, PHYSFS_sint64 *val); 01611 01612 01629 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_file *file, PHYSFS_uint64 *val); 01630 01631 01644 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_file *file, PHYSFS_sint16 val); 01645 01646 01659 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_file *file, PHYSFS_uint16 val); 01660 01661 01674 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_file *file, PHYSFS_sint16 val); 01675 01676 01689 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_file *file, PHYSFS_uint16 val); 01690 01691 01704 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_file *file, PHYSFS_sint32 val); 01705 01706 01719 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_file *file, PHYSFS_uint32 val); 01720 01721 01734 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_file *file, PHYSFS_sint32 val); 01735 01736 01749 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_file *file, PHYSFS_uint32 val); 01750 01751 01767 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_file *file, PHYSFS_sint64 val); 01768 01769 01785 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_file *file, PHYSFS_uint64 val); 01786 01787 01803 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_file *file, PHYSFS_sint64 val); 01804 01805 01821 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_file *file, PHYSFS_uint64 val); 01822 01823 01824 #ifdef __cplusplus 01825 } 01826 #endif 01827 01828 #endif /* !defined _INCLUDE_PHYSFS_H_ */ 01829 01830 /* end of physfs.h ... */ 01831