00001
00221 #ifndef _INCLUDE_PHYSFS_H_
00222 #define _INCLUDE_PHYSFS_H_
00223
00224 #ifdef __cplusplus
00225 extern "C" {
00226 #endif
00227
00228 #if defined(PHYSFS_DECL)
00229
00230 #elif (defined SWIG)
00231 #define PHYSFS_DECL extern
00232 #elif (defined _MSC_VER)
00233 #define PHYSFS_DECL __declspec(dllexport)
00234 #elif (defined __SUNPRO_C)
00235 #define PHYSFS_DECL __global
00236 #elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
00237 #define PHYSFS_DECL __attribute__((visibility("default")))
00238 #else
00239 #define PHYSFS_DECL
00240 #endif
00241
00242 #if defined(PHYSFS_DEPRECATED)
00243
00244 #elif (defined SWIG)
00245 #define PHYSFS_DEPRECATED
00246 #elif (__GNUC__ >= 4)
00247 #define PHYSFS_DEPRECATED __attribute__((deprecated))
00248 #else
00249 #define PHYSFS_DEPRECATED
00250 #endif
00251
00252 #if 0
00253 #if defined(PHYSFS_CALL)
00254
00255 #elif defined(__WIN32__) && !defined(__GNUC__)
00256 #define PHYSFS_CALL __cdecl
00257 #else
00258 #define PHYSFS_CALL
00259 #endif
00260 #endif
00261
00266 typedef unsigned char PHYSFS_uint8;
00267
00272 typedef signed char PHYSFS_sint8;
00273
00278 typedef unsigned short PHYSFS_uint16;
00279
00284 typedef signed short PHYSFS_sint16;
00285
00290 typedef unsigned int PHYSFS_uint32;
00291
00296 typedef signed int PHYSFS_sint32;
00297
00313 #if (defined PHYSFS_NO_64BIT_SUPPORT)
00314 typedef PHYSFS_uint32 PHYSFS_uint64;
00315 typedef PHYSFS_sint32 PHYSFS_sint64;
00316 #elif (defined _MSC_VER)
00317 typedef signed __int64 PHYSFS_sint64;
00318 typedef unsigned __int64 PHYSFS_uint64;
00319 #else
00320 typedef unsigned long long PHYSFS_uint64;
00321 typedef signed long long PHYSFS_sint64;
00322 #endif
00323
00324
00325 #ifndef SWIG
00326 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00327
00328 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
00329 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
00330
00331 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
00332 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
00333 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
00334 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
00335 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
00336 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
00337
00338 #ifndef PHYSFS_NO_64BIT_SUPPORT
00339 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
00340 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
00341 #endif
00342
00343 #undef PHYSFS_COMPILE_TIME_ASSERT
00344
00345 #endif
00346 #endif
00347
00348
00372 typedef struct PHYSFS_File
00373 {
00374 void *opaque;
00375 } PHYSFS_File;
00376
00377
00389 #define PHYSFS_file PHYSFS_File
00390
00391
00407 typedef struct PHYSFS_ArchiveInfo
00408 {
00409 const char *extension;
00410 const char *description;
00411 const char *author;
00412 const char *url;
00413 } PHYSFS_ArchiveInfo;
00414
00415
00429 typedef struct PHYSFS_Version
00430 {
00431 PHYSFS_uint8 major;
00432 PHYSFS_uint8 minor;
00433 PHYSFS_uint8 patch;
00434 } PHYSFS_Version;
00435
00436
00437 #ifndef SWIG
00438
00439 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00440 #define PHYSFS_VER_MAJOR 2
00441 #define PHYSFS_VER_MINOR 1
00442 #define PHYSFS_VER_PATCH 0
00443 #endif
00444
00445
00446
00447
00464 #define PHYSFS_VERSION(x) \
00465 { \
00466 (x)->major = PHYSFS_VER_MAJOR; \
00467 (x)->minor = PHYSFS_VER_MINOR; \
00468 (x)->patch = PHYSFS_VER_PATCH; \
00469 }
00470
00471 #endif
00472
00473
00500 PHYSFS_DECL void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
00501
00502
00523 PHYSFS_DECL int PHYSFS_init(const char *argv0);
00524
00525
00552 PHYSFS_DECL int PHYSFS_deinit(void);
00553
00554
00583 PHYSFS_DECL const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00584
00585
00603 PHYSFS_DECL void PHYSFS_freeList(void *listVar);
00604
00605
00654 PHYSFS_DECL const char *PHYSFS_getLastError(void);
00655
00656
00670 PHYSFS_DECL const char *PHYSFS_getDirSeparator(void);
00671
00672
00708 PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow);
00709
00710
00711
00751 PHYSFS_DECL char **PHYSFS_getCdRomDirs(void);
00752
00753
00770 PHYSFS_DECL const char *PHYSFS_getBaseDir(void);
00771
00772
00793 PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED;
00794
00795
00807 PHYSFS_DECL const char *PHYSFS_getWriteDir(void);
00808
00809
00829 PHYSFS_DECL int PHYSFS_setWriteDir(const char *newDir);
00830
00831
00852 PHYSFS_DECL int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
00853 PHYSFS_DEPRECATED;
00854
00879 PHYSFS_DECL int PHYSFS_removeFromSearchPath(const char *oldDir)
00880 PHYSFS_DEPRECATED;
00881
00882
00909 PHYSFS_DECL char **PHYSFS_getSearchPath(void);
00910
00911
00970 PHYSFS_DECL int PHYSFS_setSaneConfig(const char *organization,
00971 const char *appName,
00972 const char *archiveExt,
00973 int includeCdRoms,
00974 int archivesFirst);
00975
00976
00977
00978
01000 PHYSFS_DECL int PHYSFS_mkdir(const char *dirName);
01001
01002
01033 PHYSFS_DECL int PHYSFS_delete(const char *filename);
01034
01035
01066 PHYSFS_DECL const char *PHYSFS_getRealDir(const char *filename);
01067
01068
01107 PHYSFS_DECL char **PHYSFS_enumerateFiles(const char *dir);
01108
01109
01124 PHYSFS_DECL int PHYSFS_exists(const char *fname);
01125
01126
01147 PHYSFS_DECL int PHYSFS_isDirectory(const char *fname) PHYSFS_DEPRECATED;
01148
01149
01170 PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname) PHYSFS_DEPRECATED;
01171
01172
01194 PHYSFS_DECL PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
01195 PHYSFS_DEPRECATED;
01196
01197
01198
01199
01222 PHYSFS_DECL PHYSFS_File *PHYSFS_openWrite(const char *filename);
01223
01224
01248 PHYSFS_DECL PHYSFS_File *PHYSFS_openAppend(const char *filename);
01249
01250
01273 PHYSFS_DECL PHYSFS_File *PHYSFS_openRead(const char *filename);
01274
01275
01294 PHYSFS_DECL int PHYSFS_close(PHYSFS_File *handle);
01295
01296
01321 PHYSFS_DECL PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
01322 void *buffer,
01323 PHYSFS_uint32 objSize,
01324 PHYSFS_uint32 objCount)
01325 PHYSFS_DEPRECATED;
01326
01349 PHYSFS_DECL PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
01350 const void *buffer,
01351 PHYSFS_uint32 objSize,
01352 PHYSFS_uint32 objCount)
01353 PHYSFS_DEPRECATED;
01354
01355
01356
01357
01370 PHYSFS_DECL int PHYSFS_eof(PHYSFS_File *handle);
01371
01372
01383 PHYSFS_DECL PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
01384
01385
01400 PHYSFS_DECL int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
01401
01402
01417 PHYSFS_DECL PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
01418
01419
01420
01421
01462 PHYSFS_DECL int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
01463
01464
01481 PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle);
01482
01483
01484
01485
01486 #ifndef SWIG
01487
01498 PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01499
01500
01511 PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01512
01523 PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01524
01525
01536 PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01537
01551 PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01552
01553
01567 PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01568
01569
01580 PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01581
01582
01593 PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01594
01605 PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01606
01607
01618 PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01619
01620
01634 PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01635
01636
01650 PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01651
01652 #endif
01653
01654
01668 PHYSFS_DECL int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01669
01670
01685 PHYSFS_DECL int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01686
01687
01701 PHYSFS_DECL int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01702
01703
01718 PHYSFS_DECL int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01719
01720
01734 PHYSFS_DECL int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01735
01736
01751 PHYSFS_DECL int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01752
01753
01767 PHYSFS_DECL int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01768
01769
01784 PHYSFS_DECL int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01785
01786
01803 PHYSFS_DECL int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01804
01805
01822 PHYSFS_DECL int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01823
01824
01841 PHYSFS_DECL int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01842
01843
01860 PHYSFS_DECL int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01861
01862
01875 PHYSFS_DECL int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
01876
01877
01890 PHYSFS_DECL int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
01891
01892
01905 PHYSFS_DECL int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
01906
01907
01920 PHYSFS_DECL int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
01921
01922
01935 PHYSFS_DECL int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
01936
01937
01950 PHYSFS_DECL int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
01951
01952
01965 PHYSFS_DECL int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
01966
01967
01980 PHYSFS_DECL int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
01981
01982
01998 PHYSFS_DECL int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
01999
02000
02016 PHYSFS_DECL int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
02017
02018
02034 PHYSFS_DECL int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
02035
02036
02052 PHYSFS_DECL int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
02053
02054
02055
02056
02071 PHYSFS_DECL int PHYSFS_isInit(void);
02072
02073
02086 PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void);
02087
02088
02089 #ifndef SWIG
02090
02111 typedef struct PHYSFS_Allocator
02112 {
02113 int (*Init)(void);
02114 void (*Deinit)(void);
02115 void *(*Malloc)(PHYSFS_uint64);
02116 void *(*Realloc)(void *, PHYSFS_uint64);
02117 void (*Free)(void *);
02118 } PHYSFS_Allocator;
02119
02120
02148 PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
02149
02150 #endif
02151
02152
02194 PHYSFS_DECL int PHYSFS_mount(const char *newDir,
02195 const char *mountPoint,
02196 int appendToPath);
02197
02220 PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir);
02221
02222
02223 #ifndef SWIG
02224
02249 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
02250
02251
02283 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
02284 const char *fname);
02285
02286
02318 PHYSFS_DECL void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
02319
02320
02354 PHYSFS_DECL void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
02355
02356
02400 PHYSFS_DECL void PHYSFS_enumerateFilesCallback(const char *dir,
02401 PHYSFS_EnumFilesCallback c,
02402 void *d);
02403
02423 PHYSFS_DECL void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
02424 PHYSFS_uint64 len);
02425
02445 PHYSFS_DECL void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
02446 PHYSFS_uint64 len);
02447
02475 PHYSFS_DECL void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
02476 PHYSFS_uint64 len);
02477
02506 PHYSFS_DECL void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
02507 PHYSFS_uint64 len);
02508
02532 PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst,
02533 PHYSFS_uint64 len);
02534
02535
02536
02557 PHYSFS_DECL int PHYSFS_unmount(const char *oldDir);
02558
02592 PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void);
02593
02594 #endif
02595
02604 typedef enum PHYSFS_FileType
02605 {
02606 PHYSFS_FILETYPE_REGULAR,
02607 PHYSFS_FILETYPE_DIRECTORY,
02608 PHYSFS_FILETYPE_SYMLINK,
02609 PHYSFS_FILETYPE_OTHER
02610 } PHYSFS_FileType;
02611
02628 typedef struct PHYSFS_Stat
02629 {
02630 PHYSFS_sint64 filesize;
02631 PHYSFS_sint64 modtime;
02632 PHYSFS_sint64 createtime;
02633 PHYSFS_sint64 accesstime;
02634 PHYSFS_FileType filetype;
02635 int readonly;
02636 } PHYSFS_Stat;
02637
02657 PHYSFS_DECL int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat);
02658
02659
02660 #ifndef SWIG
02661
02686 PHYSFS_DECL void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst,
02687 PHYSFS_uint64 len);
02688
02718 PHYSFS_DECL void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst,
02719 PHYSFS_uint64 len);
02720
02721 #endif
02722
02723
02740 PHYSFS_DECL PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer,
02741 PHYSFS_uint64 len);
02742
02765 PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle,
02766 const void *buffer,
02767 PHYSFS_uint64 len);
02768
02769
02770 #ifndef SWIG
02771
02809 typedef struct PHYSFS_Io
02810 {
02830 PHYSFS_sint64 (*read)(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len);
02831
02855 PHYSFS_sint64 (*write)(struct PHYSFS_Io *io, const void *buffer,
02856 PHYSFS_uint64 len);
02857
02869 int (*seek)(struct PHYSFS_Io *io, PHYSFS_uint64 offset);
02870
02881 PHYSFS_sint64 (*tell)(struct PHYSFS_Io *io);
02882
02893 PHYSFS_sint64 (*length)(struct PHYSFS_Io *io);
02894
02903 struct PHYSFS_Io *(*duplicate)(struct PHYSFS_Io *io);
02904
02918 int (*flush)(struct PHYSFS_Io *io);
02919
02937 void (*destroy)(struct PHYSFS_Io *io);
02938
02947 void *opaque;
02948 } PHYSFS_Io;
02949
02950
02988 PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname,
02989 const char *mountPoint, int appendToPath);
02990
02991 #endif
02992
03034 PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len,
03035 void (*del)(void *), const char *fname,
03036 const char *mountPoint, int appendToPath);
03037
03038
03090 PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname,
03091 const char *mountPoint, int appendToPath);
03092
03093
03112 typedef enum PHYSFS_ErrorCode
03113 {
03114 PHYSFS_ERR_OK,
03115 PHYSFS_ERR_OTHER_ERROR,
03116 PHYSFS_ERR_OUT_OF_MEMORY,
03117 PHYSFS_ERR_NOT_INITIALIZED,
03118 PHYSFS_ERR_IS_INITIALIZED,
03119 PHYSFS_ERR_ARGV0_IS_NULL,
03120 PHYSFS_ERR_UNSUPPORTED,
03121 PHYSFS_ERR_PAST_EOF,
03122 PHYSFS_ERR_FILES_STILL_OPEN,
03123 PHYSFS_ERR_INVALID_ARGUMENT,
03124 PHYSFS_ERR_NOT_MOUNTED,
03125 PHYSFS_ERR_NO_SUCH_PATH,
03126 PHYSFS_ERR_SYMLINK_FORBIDDEN,
03127 PHYSFS_ERR_NO_WRITE_DIR,
03128 PHYSFS_ERR_OPEN_FOR_READING,
03129 PHYSFS_ERR_OPEN_FOR_WRITING,
03130 PHYSFS_ERR_NOT_A_FILE,
03131 PHYSFS_ERR_READ_ONLY,
03132 PHYSFS_ERR_CORRUPT,
03133 PHYSFS_ERR_SYMLINK_LOOP,
03134 PHYSFS_ERR_IO,
03135 PHYSFS_ERR_PERMISSION,
03136 PHYSFS_ERR_NO_SPACE,
03137 PHYSFS_ERR_BAD_FILENAME,
03138 PHYSFS_ERR_BUSY,
03139 PHYSFS_ERR_DIR_NOT_EMPTY,
03140 PHYSFS_ERR_OS_ERROR
03141 } PHYSFS_ErrorCode;
03142
03143
03172 PHYSFS_DECL PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void);
03173
03174
03203 PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code);
03204
03232 PHYSFS_DECL void PHYSFS_setErrorCode(PHYSFS_ErrorCode code);
03233
03234
03300 PHYSFS_DECL const char *PHYSFS_getPrefDir(const char *org, const char *app);
03301
03302
03303
03304
03305
03306 #ifdef __cplusplus
03307 }
03308 #endif
03309
03310 #endif
03311
03312
03313