misc/libphysfs/physfs.h
author Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Tue, 30 Dec 2014 15:56:09 +0100
changeset 10724 eedd0697d55c
parent 10017 de822cd3df3a
child 12213 bb5522e88ab2
permissions -rw-r--r--
Fix arm* build failures
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
 * \file physfs.h
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
 * Main header file for PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     8
 * \mainpage PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     9
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
 * The latest version of PhysicsFS can be found at:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
 *     http://icculus.org/physfs/
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    12
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
 * PhysicsFS; a portable, flexible file i/o abstraction.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    15
 * This API gives you access to a system file system in ways superior to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    16
 *  stdio or system i/o calls. The brief benefits:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
 *   - It's portable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
 *   - It's safe. No file access is permitted outside the specified dirs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
 *   - It's flexible. Archives (.ZIP files) can be used transparently as
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
 *      directory structures.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
 * This system is largely inspired by Quake 3's PK3 files and the related
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
 *  fs_* cvars. If you've ever tinkered with these, then this API will be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
 *  familiar to you.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    27
 * With PhysicsFS, you have a single writing directory and multiple
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
 *  directories (the "search path") for reading. You can think of this as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
 *  filesystem within a filesystem. If (on Windows) you were to set the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    30
 *  writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    31
 *  could touch anything above this directory, including the "C:\MyGame" and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    32
 *  "C:\" directories. This prevents an application's internal scripting
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    33
 *  language from piddling over c:\\config.sys, for example. If you'd rather
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    34
 *  give PHYSFS full access to the system's REAL file system, set the writing
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    35
 *  dir to "C:\", but that's generally A Bad Thing for several reasons.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    36
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    37
 * Drive letters are hidden in PhysicsFS once you set up your initial paths.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    38
 *  The search path creates a single, hierarchical directory structure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    39
 *  Not only does this lend itself well to general abstraction with archives,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    40
 *  it also gives better support to operating systems like MacOS and Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    41
 *  Generally speaking, you shouldn't ever hardcode a drive letter; not only
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
 *  does this hurt portability to non-Microsoft OSes, but it limits your win32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    43
 *  users to a single drive, too. Use the PhysicsFS abstraction functions and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    44
 *  allow user-defined configuration options, too. When opening a file, you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    45
 *  specify it like it was on a Unix filesystem: if you want to write to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    46
 *  "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    47
 *  "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    48
 *  abstraction across all platforms. Specifying a file in this way is termed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    49
 *  "platform-independent notation" in this documentation. Specifying a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
 *  a filename in a form such as "C:\mydir\myfile" or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    51
 *  "MacOS hard drive:My Directory:My File" is termed "platform-dependent
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    52
 *  notation". The only time you use platform-dependent notation is when
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    53
 *  setting up your write directory and search path; after that, all file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    54
 *  access into those directories are done with platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    56
 * All files opened for writing are opened in relation to the write directory,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    57
 *  which is the root of the writable filesystem. When opening a file for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
 *  reading, PhysicsFS goes through the search path. This is NOT the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    59
 *  same thing as the PATH environment variable. An application using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
 *  PhysicsFS specifies directories to be searched which may be actual
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
 *  directories, or archive files that contain files and subdirectories of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    62
 *  their own. See the end of these docs for currently supported archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    63
 *  formats.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    64
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
 * Once the search path is defined, you may open files for reading. If you've
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
 *  got the following search path defined (to use a win32 example again):
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    67
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    68
 *  - C:\\mygame
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
 *  - C:\\mygame\\myuserfiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
 *  - D:\\mygamescdromdatafiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
 *  - C:\\mygame\\installeddatafiles.zip
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
 * Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    74
 *  separator, lack of drive letter, and lack of dir separator at the start of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
 *  the string; this is platform-independent notation) will check for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
 *  C:\\mygame\\textfiles\\myfile.txt, then
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    77
 *  C:\\mygame\\myuserfiles\\textfiles\\myfile.txt, then
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
 *  D:\\mygamescdromdatafiles\\textfiles\\myfile.txt, then, finally, for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
 *  textfiles\\myfile.txt inside of C:\\mygame\\installeddatafiles.zip.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
 *  Remember that most archive types and platform filesystems store their
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
 *  filenames in a case-sensitive manner, so you should be careful to specify
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    82
 *  it correctly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
 * Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
 *  elements. Not only are these meaningless on MacOS Classic and/or Unix,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
 *  they are a security hole. Also, symbolic links (which can be found in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    87
 *  some archive types and directly in the filesystem on Unix platforms) are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
 *  NOT followed until you call PHYSFS_permitSymbolicLinks(). That's left to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
 *  your own discretion, as following a symlink can allow for access outside
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    90
 *  the write dir and search paths. For portability, there is no mechanism for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91
 *  creating new symlinks in PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    92
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    93
 * The write dir is not included in the search path unless you specifically
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    94
 *  add it. While you CAN change the write dir as many times as you like,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    95
 *  you should probably set it once and stick to it. Remember that your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    96
 *  program will not have permission to write in every directory on Unix and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    97
 *  NT systems.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    98
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    99
 * All files are opened in binary mode; there is no endline conversion for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   100
 *  textfiles. Other than that, PhysicsFS has some convenience functions for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
 *  platform-independence. There is a function to tell you the current
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
 *  platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   103
 *  which is needed only to set up your search/write paths. There is a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   104
 *  function to tell you what CD-ROM drives contain accessible discs, and a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   105
 *  function to recommend a good search path, etc.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
 * A recommended order for the search path is the write dir, then the base dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
 *  then the cdrom dir, then any archives discovered. Quake 3 does something
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
 *  like this, but moves the archives to the start of the search path. Build
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   110
 *  Engine games, like Duke Nukem 3D and Blood, place the archives last, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
 *  use the base dir for both searching and writing. There is a helper
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   112
 *  function (PHYSFS_setSaneConfig()) that puts together a basic configuration
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
 *  for you, based on a few parameters. Also see the comments on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
 *  PHYSFS_getBaseDir(), and PHYSFS_getPrefDir() for info on what those
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   115
 *  are and how they can help you determine an optimal search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   116
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   117
 * PhysicsFS 2.0 adds the concept of "mounting" archives to arbitrary points
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   118
 *  in the search path. If a zipfile contains "maps/level.map" and you mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   119
 *  that archive at "mods/mymod", then you would have to open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   120
 *  "mods/mymod/maps/level.map" to access the file, even though "mods/mymod"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   121
 *  isn't actually specified in the .zip file. Unlike the Unix mentality of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   122
 *  mounting a filesystem, "mods/mymod" doesn't actually have to exist when
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   123
 *  mounting the zipfile. It's a "virtual" directory. The mounting mechanism
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   124
 *  allows the developer to seperate archives in the tree and avoid trampling
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   125
 *  over files when added new archives, such as including mod support in a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   126
 *  game...keeping external content on a tight leash in this manner can be of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   127
 *  utmost importance to some applications.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   128
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   129
 * PhysicsFS is mostly thread safe. The error messages returned by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
 *  PHYSFS_getLastError() are unique by thread, and library-state-setting
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
   131
 *  functions are mutex'd. For efficiency, individual file accesses are
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
   132
 *  not locked, so you can not safely read/write/seek/close/etc the same
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
   133
 *  file from two threads at the same time. Other race conditions are bugs
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
 *  that should be reported/patched.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
 * While you CAN use stdio/syscall file access in a program that has PHYSFS_*
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
 *  calls, doing so is not recommended, and you can not use system
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
 *  filehandles with PhysicsFS and vice versa.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   139
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
 * Note that archives need not be named as such: if you have a ZIP file and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
 *  rename it with a .PKG extension, the file will still be recognized as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   142
 *  ZIP archive by PhysicsFS; the file's contents are used to determine its
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   143
 *  type where possible.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   144
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   145
 * Currently supported archive types:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   146
 *   - .ZIP (pkZip/WinZip/Info-ZIP compatible)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   147
 *   - .7Z  (7zip archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
 *   - .ISO (ISO9660 files, CD-ROM images)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
 *   - .GRP (Build Engine groupfile archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
 *   - .PAK (Quake I/II archive format)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
 *   - .HOG (Descent I/II HOG file archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   152
 *   - .MVL (Descent II movielib archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   153
 *   - .WAD (DOOM engine archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   156
 * String policy for PhysicsFS 2.0 and later:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   157
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   158
 * PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   159
 *  ASCII chars resulted in undefined behaviour, and there was no Unicode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   160
 *  support at all. PhysicsFS 2.0 supports Unicode without breaking binary
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   161
 *  compatibility with the 1.0 API by using UTF-8 encoding of all strings
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   162
 *  passed in and out of the library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   163
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   164
 * All strings passed through PhysicsFS are in null-terminated UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   165
 *  This means that if all you care about is English (ASCII characters <= 127)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   166
 *  then you just use regular C strings. If you care about Unicode (and you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   167
 *  should!) then you need to figure out what your platform wants, needs, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   168
 *  offers. If you are on Windows before Win2000 and build with Unicode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
 *  support, your TCHAR strings are two bytes per character (this is called
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   170
 *  "UCS-2 encoding"). Any modern Windows uses UTF-16, which is two bytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   171
 *  per character for most characters, but some characters are four. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   172
 *  should convert them to UTF-8 before handing them to PhysicsFS with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   173
 *  PHYSFS_utf8FromUtf16(), which handles both UTF-16 and UCS-2. If you're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   174
 *  using Unix or Mac OS X, your wchar_t strings are four bytes per character
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   175
 *  ("UCS-4 encoding"). Use PHYSFS_utf8FromUcs4(). Mac OS X can give you UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   176
 *  directly from a CFString or NSString, and many Unixes generally give you C
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   177
 *  strings in UTF-8 format everywhere. If you have a single-byte high ASCII
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   178
 *  charset, like so-many European "codepages" you may be out of luck. We'll
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   179
 *  convert from "Latin1" to UTF-8 only, and never back to Latin1. If you're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   180
 *  above ASCII 127, all bets are off: move to Unicode or use your platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   181
 *  facilities. Passing a C string with high-ASCII data that isn't UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   182
 *  encoded will NOT do what you expect!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   183
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   184
 * Naturally, there's also PHYSFS_utf8ToUcs2(), PHYSFS_utf8ToUtf16(), and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   185
 *  PHYSFS_utf8ToUcs4() to get data back into a format you like. Behind the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   186
 *  scenes, PhysicsFS will use Unicode where possible: the UTF-8 strings on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   187
 *  Windows will be converted and used with the multibyte Windows APIs, for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   188
 *  example.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   189
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   190
 * PhysicsFS offers basic encoding conversion support, but not a whole string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   191
 *  library. Get your stuff into whatever format you can work with.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   192
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   193
 * All platforms supported by PhysicsFS 2.1 and later fully support Unicode.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   194
 *  We have dropped platforms that don't (OS/2, Mac OS 9, Windows 95, etc), as
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   195
 *  even an OS that's over a decade old should be expected to handle this well.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
 *  If you absolutely must support one of these platforms, you should use an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   197
 *  older release of PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   198
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   199
 * Many game-specific archivers are seriously unprepared for Unicode (the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   200
 *  Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
 *  DOS 8.3 filename, for example). Nothing can be done for these, but they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   202
 *  tend to be legacy formats for existing content that was all ASCII (and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   203
 *  thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   204
 *  offer Unicode support, but unofficially expect filenames to be UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   205
 *  encoded, and thus Just Work. Most everything does the right thing without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   206
 *  bothering you, but it's good to be aware of these nuances in case they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   207
 *  don't.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   208
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   209
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   210
 * Other stuff:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   211
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   212
 * Please see the file LICENSE.txt in the source's root directory for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   213
 *  licensing and redistribution rights.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   214
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   215
 * Please see the file CREDITS.txt in the source's "docs" directory for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   216
 *  a more or less complete list of who's responsible for this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   217
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   218
 *  \author Ryan C. Gordon.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   219
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   220
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   221
#ifndef _INCLUDE_PHYSFS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   222
#define _INCLUDE_PHYSFS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   223
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   224
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
extern "C" {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   228
#if defined(PHYSFS_DECL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   229
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   230
#elif (defined SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   231
#define PHYSFS_DECL extern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   232
#elif (defined _MSC_VER)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   233
#define PHYSFS_DECL __declspec(dllexport)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   234
#elif (defined __SUNPRO_C)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   235
#define PHYSFS_DECL __global
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   236
#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   237
#define PHYSFS_DECL __attribute__((visibility("default")))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   238
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   239
#define PHYSFS_DECL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   240
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   242
#if defined(PHYSFS_DEPRECATED)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   243
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   244
#elif (defined SWIG)  /* ignore deprecated, since bindings use everything. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   245
#define PHYSFS_DEPRECATED
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   246
#elif (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
#define PHYSFS_DEPRECATED __attribute__((deprecated))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   248
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   249
#define PHYSFS_DEPRECATED
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   250
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   252
#if 0  /* !!! FIXME: look into this later. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   253
#if defined(PHYSFS_CALL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   254
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   255
#elif defined(__WIN32__) && !defined(__GNUC__)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   256
#define PHYSFS_CALL __cdecl
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   257
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   258
#define PHYSFS_CALL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   260
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   261
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   262
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   263
 * \typedef PHYSFS_uint8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   264
 * \brief An unsigned, 8-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   265
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   266
typedef unsigned char         PHYSFS_uint8;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   267
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   268
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   269
 * \typedef PHYSFS_sint8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   270
 * \brief A signed, 8-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   271
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   272
typedef signed char           PHYSFS_sint8;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   273
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   274
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   275
 * \typedef PHYSFS_uint16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   276
 * \brief An unsigned, 16-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   277
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   278
typedef unsigned short        PHYSFS_uint16;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   279
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   280
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   281
 * \typedef PHYSFS_sint16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   282
 * \brief A signed, 16-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   283
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   284
typedef signed short          PHYSFS_sint16;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   285
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   286
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
 * \typedef PHYSFS_uint32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   288
 * \brief An unsigned, 32-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   289
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   290
typedef unsigned int          PHYSFS_uint32;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   291
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   293
 * \typedef PHYSFS_sint32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   294
 * \brief A signed, 32-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   295
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   296
typedef signed int            PHYSFS_sint32;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   297
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   298
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   299
 * \typedef PHYSFS_uint64
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   300
 * \brief An unsigned, 64-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   301
 * \warning on platforms without any sort of 64-bit datatype, this is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   302
 *           equivalent to PHYSFS_uint32!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   303
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   304
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   305
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   306
 * \typedef PHYSFS_sint64
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   307
 * \brief A signed, 64-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   308
 * \warning on platforms without any sort of 64-bit datatype, this is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   309
 *           equivalent to PHYSFS_sint32!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   310
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   311
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   312
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   313
#if (defined PHYSFS_NO_64BIT_SUPPORT)  /* oh well. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   314
typedef PHYSFS_uint32         PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   315
typedef PHYSFS_sint32         PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   316
#elif (defined _MSC_VER)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   317
typedef signed __int64        PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   318
typedef unsigned __int64      PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   319
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   320
typedef unsigned long long    PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   321
typedef signed long long      PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   322
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   323
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   324
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   325
#ifndef SWIG
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   326
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   327
/* Make sure the types really have the right sizes */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   328
#define PHYSFS_COMPILE_TIME_ASSERT(name, x)               \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   329
       typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   330
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   331
PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   332
PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   333
PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   334
PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   335
PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   336
PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   337
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   338
#ifndef PHYSFS_NO_64BIT_SUPPORT
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   339
PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   340
PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   341
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   342
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   343
#undef PHYSFS_COMPILE_TIME_ASSERT
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   344
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   345
#endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   346
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   347
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   348
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   349
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   350
 * \struct PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   351
 * \brief A PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   352
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   353
 * You get a pointer to one of these when you open a file for reading,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   354
 *  writing, or appending via PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   355
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   356
 * As you can see from the lack of meaningful fields, you should treat this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   357
 *  as opaque data. Don't try to manipulate the file handle, just pass the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   358
 *  pointer you got, unmolested, to various PhysicsFS APIs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   359
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   360
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   361
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   362
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   363
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   364
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   365
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   366
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   367
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   368
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   369
 * \sa PHYSFS_setBuffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   370
 * \sa PHYSFS_flush
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   371
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   372
typedef struct PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   373
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   374
    void *opaque;  /**< That's all you get. Don't touch. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   375
} PHYSFS_File;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   376
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   377
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   378
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   379
 * \def PHYSFS_file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   380
 * \brief 1.0 API compatibility define.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   381
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   382
 * PHYSFS_file is identical to PHYSFS_File. This #define is here for backwards
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   383
 *  compatibility with the 1.0 API, which had an inconsistent capitalization
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   384
 *  convention in this case. New code should use PHYSFS_File, as this #define
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   385
 *  may go away someday.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   386
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   387
 * \sa PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   388
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   389
#define PHYSFS_file PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   390
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   391
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   392
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   393
 * \struct PHYSFS_ArchiveInfo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   394
 * \brief Information on various PhysicsFS-supported archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   395
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   396
 * This structure gives you details on what sort of archives are supported
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   397
 *  by this implementation of PhysicsFS. Archives tend to be things like
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   398
 *  ZIP files and such.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   399
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   400
 * \warning Not all binaries are created equal! PhysicsFS can be built with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   401
 *          or without support for various archives. You can check with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   402
 *          PHYSFS_supportedArchiveTypes() to see if your archive type is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   403
 *          supported.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   404
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   405
 * \sa PHYSFS_supportedArchiveTypes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   406
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   407
typedef struct PHYSFS_ArchiveInfo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   408
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   409
    const char *extension;   /**< Archive file extension: "ZIP", for example. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   410
    const char *description; /**< Human-readable archive description. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   411
    const char *author;      /**< Person who did support for this archive. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   412
    const char *url;         /**< URL related to this archive */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   413
} PHYSFS_ArchiveInfo;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   414
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   415
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   416
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   417
 * \struct PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   418
 * \brief Information the version of PhysicsFS in use.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   419
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   420
 * Represents the library's version as three levels: major revision
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   421
 *  (increments with massive changes, additions, and enhancements),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   422
 *  minor revision (increments with backwards-compatible changes to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   423
 *  major revision), and patchlevel (increments with fixes to the minor
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   424
 *  revision).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   425
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   426
 * \sa PHYSFS_VERSION
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   427
 * \sa PHYSFS_getLinkedVersion
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   428
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   429
typedef struct PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   430
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   431
    PHYSFS_uint8 major; /**< major revision */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   432
    PHYSFS_uint8 minor; /**< minor revision */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   433
    PHYSFS_uint8 patch; /**< patchlevel */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   434
} PHYSFS_Version;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   435
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   436
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   437
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   438
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   439
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   440
#define PHYSFS_VER_MAJOR 2
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   441
#define PHYSFS_VER_MINOR 1
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   442
#define PHYSFS_VER_PATCH 0
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   443
#endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   444
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   445
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   446
/* PhysicsFS state stuff ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   447
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   448
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   449
 * \def PHYSFS_VERSION(x)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   450
 * \brief Macro to determine PhysicsFS version program was compiled against.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   451
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   452
 * This macro fills in a PHYSFS_Version structure with the version of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   453
 *  library you compiled against. This is determined by what header the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   454
 *  compiler uses. Note that if you dynamically linked the library, you might
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   455
 *  have a slightly newer or older version at runtime. That version can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   456
 *  determined with PHYSFS_getLinkedVersion(), which, unlike PHYSFS_VERSION,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   457
 *  is not a macro.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   458
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   459
 * \param x A pointer to a PHYSFS_Version struct to initialize.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   460
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   461
 * \sa PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   462
 * \sa PHYSFS_getLinkedVersion
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   463
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   464
#define PHYSFS_VERSION(x) \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   465
{ \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   466
    (x)->major = PHYSFS_VER_MAJOR; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   467
    (x)->minor = PHYSFS_VER_MINOR; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   468
    (x)->patch = PHYSFS_VER_PATCH; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   469
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   470
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   471
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   472
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   473
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   474
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   475
 * \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   476
 * \brief Get the version of PhysicsFS that is linked against your program.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   477
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   478
 * If you are using a shared library (DLL) version of PhysFS, then it is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   479
 *  possible that it will be different than the version you compiled against.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   480
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   481
 * This is a real function; the macro PHYSFS_VERSION tells you what version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   482
 *  of PhysFS you compiled against:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   483
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   484
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   485
 * PHYSFS_Version compiled;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   486
 * PHYSFS_Version linked;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   487
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   488
 * PHYSFS_VERSION(&compiled);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   489
 * PHYSFS_getLinkedVersion(&linked);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   490
 * printf("We compiled against PhysFS version %d.%d.%d ...\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   491
 *           compiled.major, compiled.minor, compiled.patch);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   492
 * printf("But we linked against PhysFS version %d.%d.%d.\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   493
 *           linked.major, linked.minor, linked.patch);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   494
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   495
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   496
 * This function may be called safely at any time, even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   497
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   498
 * \sa PHYSFS_VERSION
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   499
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   500
PHYSFS_DECL void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   501
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   502
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   503
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   504
 * \fn int PHYSFS_init(const char *argv0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   505
 * \brief Initialize the PhysicsFS library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   506
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   507
 * This must be called before any other PhysicsFS function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   508
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   509
 * This should be called prior to any attempts to change your process's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   510
 *  current working directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   511
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   512
 *   \param argv0 the argv[0] string passed to your program's mainline.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   513
 *          This may be NULL on most platforms (such as ones without a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   514
 *          standard main() function), but you should always try to pass
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   515
 *          something in here. Unix-like systems such as Linux _need_ to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   516
 *          pass argv[0] from main() in here.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   517
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   518
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   519
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   520
 * \sa PHYSFS_deinit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   521
 * \sa PHYSFS_isInit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   522
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   523
PHYSFS_DECL int PHYSFS_init(const char *argv0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   524
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   525
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   526
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   527
 * \fn int PHYSFS_deinit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   528
 * \brief Deinitialize the PhysicsFS library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   529
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   530
 * This closes any files opened via PhysicsFS, blanks the search/write paths,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   531
 *  frees memory, and invalidates all of your file handles.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   532
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   533
 * Note that this call can FAIL if there's a file open for writing that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   534
 *  refuses to close (for example, the underlying operating system was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   535
 *  buffering writes to network filesystem, and the fileserver has crashed,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   536
 *  or a hard drive has failed, etc). It is usually best to close all write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   537
 *  handles yourself before calling this function, so that you can gracefully
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   538
 *  handle a specific failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   539
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   540
 * Once successfully deinitialized, PHYSFS_init() can be called again to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   541
 *  restart the subsystem. All default API states are restored at this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   542
 *  point, with the exception of any custom allocator you might have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   543
 *  specified, which survives between initializations.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   544
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   545
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   546
 *          gleaned from PHYSFS_getLastError(). If failure, state of PhysFS is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   547
 *          undefined, and probably badly screwed up.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   548
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   549
 * \sa PHYSFS_init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   550
 * \sa PHYSFS_isInit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   551
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   552
PHYSFS_DECL int PHYSFS_deinit(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   553
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   554
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   555
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   556
 * \fn const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   557
 * \brief Get a list of supported archive types.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   558
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   559
 * Get a list of archive types supported by this implementation of PhysicFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   560
 *  These are the file formats usable for search path entries. This is for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   561
 *  informational purposes only. Note that the extension listed is merely
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   562
 *  convention: if we list "ZIP", you can open a PkZip-compatible archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   563
 *  with an extension of "XYZ", if you like.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   564
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   565
 * The returned value is an array of pointers to PHYSFS_ArchiveInfo structures,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   566
 *  with a NULL entry to signify the end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   567
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   568
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   569
 * PHYSFS_ArchiveInfo **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   570
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   571
 * for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   572
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   573
 *     printf("Supported archive: [%s], which is [%s].\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   574
 *              (*i)->extension, (*i)->description);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   575
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   576
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   577
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   578
 * The return values are pointers to internal memory, and should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   579
 *  be considered READ ONLY, and never freed. The returned values are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   580
 *  valid until the next call to PHYSFS_deinit().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   581
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   582
 *   \return READ ONLY Null-terminated array of READ ONLY structures.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   583
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   584
PHYSFS_DECL const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   585
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   586
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   587
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   588
 * \fn void PHYSFS_freeList(void *listVar)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   589
 * \brief Deallocate resources of lists returned by PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   590
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   591
 * Certain PhysicsFS functions return lists of information that are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   592
 *  dynamically allocated. Use this function to free those resources.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   593
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   594
 * It is safe to pass a NULL here, but doing so will cause a crash in versions
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   595
 *  before PhysicsFS 2.1.0.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   596
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   597
 *   \param listVar List of information specified as freeable by this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   598
 *                  Passing NULL is safe; it is a valid no-op.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   599
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   600
 * \sa PHYSFS_getCdRomDirs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   601
 * \sa PHYSFS_enumerateFiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   602
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   603
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   604
PHYSFS_DECL void PHYSFS_freeList(void *listVar);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   605
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   606
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   607
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   608
 * \fn const char *PHYSFS_getLastError(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   609
 * \brief Get human-readable error information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   610
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   611
 * \warning As of PhysicsFS 2.1, this function has been nerfed.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   612
 *          Before PhysicsFS 2.1, this function was the only way to get
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   613
 *          error details beyond a given function's basic return value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   614
 *          This was meant to be a human-readable string in one of several
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   615
 *          languages, and was not useful for application parsing. This was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   616
 *          a problem, because the developer and not the user chose the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   617
 *          language at compile time, and the PhysicsFS maintainers had
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   618
 *          to (poorly) maintain a significant amount of localization work.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   619
 *          The app couldn't parse the strings, even if they counted on a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   620
 *          specific language, since some were dynamically generated.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   621
 *          In 2.1 and later, this always returns a static string in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   622
 *          English; you may use it as a key string for your own
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   623
 *          localizations if you like, as we'll promise not to change
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   624
 *          existing error strings. Also, if your application wants to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   625
 *          look at specific errors, we now offer a better option:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   626
 *          use PHYSFS_getLastErrorCode() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   627
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   628
 * Get the last PhysicsFS error message as a human-readable, null-terminated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   629
 *  string. This will return NULL if there's been no error since the last call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   630
 *  to this function. The pointer returned by this call points to an internal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   631
 *  buffer. Each thread has a unique error state associated with it, but each
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   632
 *  time a new error message is set, it will overwrite the previous one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   633
 *  associated with that thread. It is safe to call this function at anytime,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   634
 *  even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   635
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   636
 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   637
 *  thread-specific error state. Calling one will wipe out the other's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   638
 *  data. If you need both, call PHYSFS_getLastErrorCode(), then pass that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   639
 *  value to PHYSFS_getErrorByCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   640
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   641
 * As of PhysicsFS 2.1, this function only presents text in the English
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   642
 *  language, but the strings are static, so you can use them as keys into
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   643
 *  your own localization dictionary. These strings are meant to be passed on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   644
 *  directly to the user.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   645
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   646
 * Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   647
 *  given function failed; however, if your code require more specifics, you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   648
 *  should use PHYSFS_getLastErrorCode() instead of this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   649
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   650
 *   \return READ ONLY string of last error message.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   651
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   652
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   653
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   654
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   655
PHYSFS_DECL const char *PHYSFS_getLastError(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   656
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   657
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   658
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   659
 * \fn const char *PHYSFS_getDirSeparator(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   660
 * \brief Get platform-dependent dir separator string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   661
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   662
 * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   663
 *  than one character, depending on the platform, and your code should take
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   664
 *  that into account. Note that this is only useful for setting up the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   665
 *  search/write paths, since access into those dirs always use '/'
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   666
 *  (platform-independent notation) to separate directories. This is also
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   667
 *  handy for getting platform-independent access when using stdio calls.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   668
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   669
 *   \return READ ONLY null-terminated string of platform's dir separator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   670
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   671
PHYSFS_DECL const char *PHYSFS_getDirSeparator(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   672
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   673
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   674
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   675
 * \fn void PHYSFS_permitSymbolicLinks(int allow)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   676
 * \brief Enable or disable following of symbolic links.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   677
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   678
 * Some physical filesystems and archives contain files that are just pointers
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   679
 *  to other files. On the physical filesystem, opening such a link will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   680
 *  (transparently) open the file that is pointed to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   681
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   682
 * By default, PhysicsFS will check if a file is really a symlink during open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   683
 *  calls and fail if it is. Otherwise, the link could take you outside the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   684
 *  write and search paths, and compromise security.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   685
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   686
 * If you want to take that risk, call this function with a non-zero parameter.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   687
 *  Note that this is more for sandboxing a program's scripting language, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   688
 *  case untrusted scripts try to compromise the system. Generally speaking,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   689
 *  a user could very well have a legitimate reason to set up a symlink, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   690
 *  unless you feel there's a specific danger in allowing them, you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   691
 *  permit them.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   692
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   693
 * Symlinks are only explicitly checked when dealing with filenames
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   694
 *  in platform-independent notation. That is, when setting up your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   695
 *  search and write paths, etc, symlinks are never checked for.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   696
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   697
 * Please note that PHYSFS_stat() will always check the path specified; if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   698
 *  that path is a symlink, it will not be followed in any case. If symlinks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   699
 *  aren't permitted through this function, PHYSFS_stat() ignores them, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   700
 *  would treat the query as if the path didn't exist at all.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   701
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   702
 * Symbolic link permission can be enabled or disabled at any time after
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   703
 *  you've called PHYSFS_init(), and is disabled by default.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   704
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   705
 *   \param allow nonzero to permit symlinks, zero to deny linking.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   706
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   707
 * \sa PHYSFS_symbolicLinksPermitted
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   708
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   709
PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   710
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   711
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   712
/* !!! FIXME: const this? */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   713
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   714
 * \fn char **PHYSFS_getCdRomDirs(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   715
 * \brief Get an array of paths to available CD-ROM drives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   716
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   717
 * The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   718
 *  whatnot on Unix). Dirs are only returned if there is a disc ready and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   719
 *  accessible in the drive. So if you've got two drives (D: and E:), and only
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   720
 *  E: has a disc in it, then that's all you get. If the user inserts a disc
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   721
 *  in D: and you call this function again, you get both drives. If, on a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   722
 *  Unix box, the user unmounts a disc and remounts it elsewhere, the next
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   723
 *  call to this function will reflect that change.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   724
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   725
 * This function refers to "CD-ROM" media, but it really means "inserted disc
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   726
 *  media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. It looks for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   727
 *  filesystems, and as such won't report an audio CD, unless there's a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   728
 *  mounted filesystem track on it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   729
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   730
 * The returned value is an array of strings, with a NULL entry to signify the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   731
 *  end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   732
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   733
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   734
 * char **cds = PHYSFS_getCdRomDirs();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   735
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   736
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   737
 * for (i = cds; *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   738
 *     printf("cdrom dir [%s] is available.\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   739
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   740
 * PHYSFS_freeList(cds);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   741
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   742
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   743
 * This call may block while drives spin up. Be forewarned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   744
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   745
 * When you are done with the returned information, you may dispose of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   746
 *  resources by calling PHYSFS_freeList() with the returned pointer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   747
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   748
 *   \return Null-terminated array of null-terminated strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   749
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   750
 * \sa PHYSFS_getCdRomDirsCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   751
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   752
PHYSFS_DECL char **PHYSFS_getCdRomDirs(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   753
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   754
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   755
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   756
 * \fn const char *PHYSFS_getBaseDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   757
 * \brief Get the path where the application resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   758
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   759
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   760
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   761
 * Get the "base dir". This is the directory where the application was run
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   762
 *  from, which is probably the installation directory, and may or may not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   763
 *  be the process's current working directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   764
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   765
 * You should probably use the base dir in your search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   766
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   767
 *  \return READ ONLY string of base dir in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   768
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   769
 * \sa PHYSFS_getPrefDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   770
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   771
PHYSFS_DECL const char *PHYSFS_getBaseDir(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   772
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   773
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   774
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   775
 * \fn const char *PHYSFS_getUserDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   776
 * \brief Get the path where user's home directory resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   777
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   778
 * \deprecated As of PhysicsFS 2.1, you probably want PHYSFS_getPrefDir().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   779
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   780
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   781
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   782
 * Get the "user dir". This is meant to be a suggestion of where a specific
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   783
 *  user of the system can store files. On Unix, this is her home directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   784
 *  On systems with no concept of multiple home directories (MacOS, win95),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   785
 *  this will default to something like "C:\mybasedir\users\username"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   786
 *  where "username" will either be the login name, or "default" if the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   787
 *  platform doesn't support multiple users, either.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   788
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   789
 *  \return READ ONLY string of user dir in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   790
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   791
 * \sa PHYSFS_getBaseDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   792
 * \sa PHYSFS_getPrefDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   793
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   794
PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   795
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   796
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   797
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   798
 * \fn const char *PHYSFS_getWriteDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   799
 * \brief Get path where PhysicsFS will allow file writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   800
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   801
 * Get the current write dir. The default write dir is NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   802
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   803
 *  \return READ ONLY string of write dir in platform-dependent notation,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   804
 *           OR NULL IF NO WRITE PATH IS CURRENTLY SET.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   805
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   806
 * \sa PHYSFS_setWriteDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   807
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   808
PHYSFS_DECL const char *PHYSFS_getWriteDir(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   809
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   810
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   811
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   812
 * \fn int PHYSFS_setWriteDir(const char *newDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   813
 * \brief Tell PhysicsFS where it may write files.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   814
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   815
 * Set a new write dir. This will override the previous setting.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   816
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   817
 * This call will fail (and fail to change the write dir) if the current
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   818
 *  write dir still has files open in it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   819
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   820
 *   \param newDir The new directory to be the root of the write dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   821
 *                   specified in platform-dependent notation. Setting to NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   822
 *                   disables the write dir, so no files can be opened for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   823
 *                   writing via PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   824
 *  \return non-zero on success, zero on failure. All attempts to open a file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   825
 *           for writing via PhysicsFS will fail until this call succeeds.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   826
 *           Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   827
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   828
 * \sa PHYSFS_getWriteDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   829
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   830
PHYSFS_DECL int PHYSFS_setWriteDir(const char *newDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   831
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   832
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   833
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   834
 * \fn int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   835
 * \brief Add an archive or directory to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   836
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   837
 * \deprecated As of PhysicsFS 2.0, use PHYSFS_mount() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   838
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   839
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   840
 * This function is equivalent to:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   841
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   842
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   843
 *  PHYSFS_mount(newDir, NULL, appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   844
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   845
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   846
 * You must use this and not PHYSFS_mount if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   847
 *  PhysicsFS 1.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   848
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   849
 * \sa PHYSFS_mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   850
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   851
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   852
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   853
PHYSFS_DECL int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   854
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   855
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   856
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   857
 * \fn int PHYSFS_removeFromSearchPath(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   858
 * \brief Remove a directory or archive from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   859
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   860
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_unmount() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   861
 *             function just wraps it anyhow. There's no functional difference
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   862
 *             except the vocabulary changed from "adding to the search path"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   863
 *             to "mounting" when that functionality was extended, and thus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   864
 *             the preferred way to accomplish this function's work is now
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   865
 *             called "unmounting."
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   866
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   867
 * This function is equivalent to:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   868
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   869
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   870
 *  PHYSFS_unmount(oldDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   871
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   872
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   873
 * You must use this and not PHYSFS_unmount if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   874
 *  PhysicsFS 1.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   875
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   876
 * \sa PHYSFS_addToSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   877
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   878
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   879
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   880
PHYSFS_DECL int PHYSFS_removeFromSearchPath(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   881
                                            PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   882
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   883
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   884
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   885
 * \fn char **PHYSFS_getSearchPath(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   886
 * \brief Get the current search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   887
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   888
 * The default search path is an empty list.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   889
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   890
 * The returned value is an array of strings, with a NULL entry to signify the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   891
 *  end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   892
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   893
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   894
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   895
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   896
 * for (i = PHYSFS_getSearchPath(); *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   897
 *     printf("[%s] is in the search path.\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   898
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   899
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   900
 * When you are done with the returned information, you may dispose of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   901
 *  resources by calling PHYSFS_freeList() with the returned pointer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   902
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   903
 *   \return Null-terminated array of null-terminated strings. NULL if there
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   904
 *            was a problem (read: OUT OF MEMORY).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   905
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   906
 * \sa PHYSFS_getSearchPathCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   907
 * \sa PHYSFS_addToSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   908
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   909
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   910
PHYSFS_DECL char **PHYSFS_getSearchPath(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   911
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   912
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   913
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   914
 * \fn int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   915
 * \brief Set up sane, default paths.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   916
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   917
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   918
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   919
 * The write dir will be set to the pref dir returned by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   920
 *  \code PHYSFS_getPrefDir(organization, appName) \endcode, which is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   921
 *  created if it doesn't exist.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   922
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   923
 * The above is sufficient to make sure your program's configuration directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   924
 *  is separated from other clutter, and platform-independent.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   925
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   926
 *  The search path will be:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   927
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   928
 *    - The Write Dir (created if it doesn't exist)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   929
 *    - The Base Dir (PHYSFS_getBaseDir())
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   930
 *    - All found CD-ROM dirs (optionally)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   931
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   932
 * These directories are then searched for files ending with the extension
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   933
 *  (archiveExt), which, if they are valid and supported archives, will also
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   934
 *  be added to the search path. If you specified "PKG" for (archiveExt), and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   935
 *  there's a file named data.PKG in the base dir, it'll be checked. Archives
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   936
 *  can either be appended or prepended to the search path in alphabetical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   937
 *  order, regardless of which directories they were found in. All archives
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   938
 *  are mounted in the root of the virtual file system ("/").
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   939
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   940
 * All of this can be accomplished from the application, but this just does it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   941
 *  all for you. Feel free to add more to the search path manually, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   942
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   943
 *    \param organization Name of your company/group/etc to be used as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   944
 *                         dirname, so keep it small, and no-frills.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   945
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   946
 *    \param appName Program-specific name of your program, to separate it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   947
 *                   from other programs using PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   948
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   949
 *    \param archiveExt File extension used by your program to specify an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   950
 *                      archive. For example, Quake 3 uses "pk3", even though
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   951
 *                      they are just zipfiles. Specify NULL to not dig out
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   952
 *                      archives automatically. Do not specify the '.' char;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   953
 *                      If you want to look for ZIP files, specify "ZIP" and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   954
 *                      not ".ZIP" ... the archive search is case-insensitive.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   955
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   956
 *    \param includeCdRoms Non-zero to include CD-ROMs in the search path, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   957
 *                         (if (archiveExt) != NULL) search them for archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   958
 *                         This may cause a significant amount of blocking
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   959
 *                         while discs are accessed, and if there are no discs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   960
 *                         in the drive (or even not mounted on Unix systems),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   961
 *                         then they may not be made available anyhow. You may
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   962
 *                         want to specify zero and handle the disc setup
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   963
 *                         yourself.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   964
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   965
 *    \param archivesFirst Non-zero to prepend the archives to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   966
 *                          Zero to append them. Ignored if !(archiveExt).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   967
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   968
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   969
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   970
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   971
PHYSFS_DECL int PHYSFS_setSaneConfig(const char *organization,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   972
                                     const char *appName,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   973
                                     const char *archiveExt,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   974
                                     int includeCdRoms,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   975
                                     int archivesFirst);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   976
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   977
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   978
/* Directory management stuff ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   979
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   980
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   981
 * \fn int PHYSFS_mkdir(const char *dirName)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   982
 * \brief Create a directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   983
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   984
 * This is specified in platform-independent notation in relation to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   985
 *  write dir. All missing parent directories are also created if they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   986
 *  don't exist.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   987
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   988
 * So if you've got the write dir set to "C:\mygame\writedir" and call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   989
 *  PHYSFS_mkdir("downloads/maps") then the directories
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   990
 *  "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   991
 *  will be created if possible. If the creation of "maps" fails after we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   992
 *  have successfully created "downloads", then the function leaves the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   993
 *  created directory behind and reports failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   994
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   995
 *   \param dirName New dir to create.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   996
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   997
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   998
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   999
 * \sa PHYSFS_delete
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1000
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1001
PHYSFS_DECL int PHYSFS_mkdir(const char *dirName);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1002
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1003
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1004
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1005
 * \fn int PHYSFS_delete(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1006
 * \brief Delete a file or directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1007
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1008
 * (filename) is specified in platform-independent notation in relation to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1009
 *  write dir.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1010
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1011
 * A directory must be empty before this call can delete it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1012
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1013
 * Deleting a symlink will remove the link, not what it points to, regardless
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1014
 *  of whether you "permitSymLinks" or not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1015
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1016
 * So if you've got the write dir set to "C:\mygame\writedir" and call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1017
 *  PHYSFS_delete("downloads/maps/level1.map") then the file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1018
 *  "C:\mygame\writedir\downloads\maps\level1.map" is removed from the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1019
 *  physical filesystem, if it exists and the operating system permits the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1020
 *  deletion.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1021
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1022
 * Note that on Unix systems, deleting a file may be successful, but the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1023
 *  actual file won't be removed until all processes that have an open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1024
 *  filehandle to it (including your program) close their handles.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1025
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1026
 * Chances are, the bits that make up the file still exist, they are just
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1027
 *  made available to be written over at a later point. Don't consider this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1028
 *  a security method or anything.  :)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1029
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1030
 *   \param filename Filename to delete.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1031
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1032
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1033
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1034
PHYSFS_DECL int PHYSFS_delete(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1035
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1036
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1037
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1038
 * \fn const char *PHYSFS_getRealDir(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1039
 * \brief Figure out where in the search path a file resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1040
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1041
 * The file is specified in platform-independent notation. The returned
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1042
 *  filename will be the element of the search path where the file was found,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1043
 *  which may be a directory, or an archive. Even if there are multiple
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1044
 *  matches in different parts of the search path, only the first one found
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1045
 *  is used, just like when opening a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1046
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1047
 * So, if you look for "maps/level1.map", and C:\\mygame is in your search
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1048
 *  path and C:\\mygame\\maps\\level1.map exists, then "C:\mygame" is returned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1049
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1050
 * If a any part of a match is a symbolic link, and you've not explicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1051
 *  permitted symlinks, then it will be ignored, and the search for a match
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1052
 *  will continue.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1053
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1054
 * If you specify a fake directory that only exists as a mount point, it'll
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1055
 *  be associated with the first archive mounted there, even though that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1056
 *  directory isn't necessarily contained in a real archive.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1057
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1058
 * \warning This will return NULL if there is no real directory associated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1059
 *          with (filename). Specifically, PHYSFS_mountIo(),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1060
 *          PHYSFS_mountMemory(), and PHYSFS_mountHandle() will return NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1061
 *          even if the filename is found in the search path. Plan accordingly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1062
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1063
 *     \param filename file to look for.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1064
 *    \return READ ONLY string of element of search path containing the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1065
 *             the file in question. NULL if not found.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1066
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1067
PHYSFS_DECL const char *PHYSFS_getRealDir(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1068
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1069
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1070
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1071
 * \fn char **PHYSFS_enumerateFiles(const char *dir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1072
 * \brief Get a file listing of a search path's directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1073
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1074
 * Matching directories are interpolated. That is, if "C:\mydir" is in the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1075
 *  search path and contains a directory "savegames" that contains "x.sav",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1076
 *  "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1077
 *  that has a "savegames" subdirectory with "w.sav", then the following code:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1078
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1079
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1080
 * char **rc = PHYSFS_enumerateFiles("savegames");
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1081
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1082
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1083
 * for (i = rc; *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1084
 *     printf(" * We've got [%s].\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1085
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1086
 * PHYSFS_freeList(rc);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1087
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1088
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1089
 *  \...will print:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1090
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1091
 * \verbatim
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1092
 * We've got [x.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1093
 * We've got [y.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1094
 * We've got [z.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1095
 * We've got [w.sav].\endverbatim
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1096
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1097
 * Feel free to sort the list however you like. We only promise there will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1098
 *  be no duplicates, but not what order the final list will come back in.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1099
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1100
 * Don't forget to call PHYSFS_freeList() with the return value from this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1101
 *  function when you are done with it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1102
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1103
 *    \param dir directory in platform-independent notation to enumerate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1104
 *   \return Null-terminated array of null-terminated strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1105
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1106
 * \sa PHYSFS_enumerateFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1107
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1108
PHYSFS_DECL char **PHYSFS_enumerateFiles(const char *dir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1109
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1110
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1111
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1112
 * \fn int PHYSFS_exists(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1113
 * \brief Determine if a file exists in the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1114
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1115
 * Reports true if there is an entry anywhere in the search path by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1116
 *  name of (fname).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1117
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1118
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1119
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1120
 *  might end up further down in the search path than expected.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1121
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1122
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1123
 *   \return non-zero if filename exists. zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1124
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1125
PHYSFS_DECL int PHYSFS_exists(const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1126
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1127
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1128
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1129
 * \fn int PHYSFS_isDirectory(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1130
 * \brief Determine if a file in the search path is really a directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1131
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1132
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1133
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1134
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1135
 * Determine if the first occurence of (fname) in the search path is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1136
 *  really a directory entry.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1137
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1138
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1139
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1140
 *  might end up further down in the search path than expected.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1141
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1142
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1143
 *   \return non-zero if filename exists and is a directory.  zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1144
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1145
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1146
 * \sa PHYSFS_exists
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1147
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1148
PHYSFS_DECL int PHYSFS_isDirectory(const char *fname) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1149
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1150
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1151
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1152
 * \fn int PHYSFS_isSymbolicLink(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1153
 * \brief Determine if a file in the search path is really a symbolic link.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1154
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1155
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1156
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1157
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1158
 * Determine if the first occurence of (fname) in the search path is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1159
 *  really a symbolic link.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1160
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1161
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1162
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and as such,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1163
 *  this function will always return 0 in that case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1164
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1165
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1166
 *   \return non-zero if filename exists and is a symlink.  zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1167
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1168
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1169
 * \sa PHYSFS_exists
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1170
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1171
PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1172
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1173
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1174
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1175
 * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1176
 * \brief Get the last modification time of a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1177
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1178
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1179
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1180
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1181
 * The modtime is returned as a number of seconds since the Unix epoch
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1182
 *  (midnight, Jan 1, 1970). The exact derivation and accuracy of this time
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1183
 *  depends on the particular archiver. If there is no reasonable way to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1184
 *  obtain this information for a particular archiver, or there was some sort
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1185
 *  of error, this function returns (-1).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1186
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1187
 * You must use this and not PHYSFS_stat() if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1188
 *  PhysicsFS 2.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1189
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1190
 *   \param filename filename to check, in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1191
 *  \return last modified time of the file. -1 if it can't be determined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1192
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1193
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1194
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1195
PHYSFS_DECL PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1196
                                                PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1197
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1198
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1199
/* i/o stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1200
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1201
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1202
 * \fn PHYSFS_File *PHYSFS_openWrite(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1203
 * \brief Open a file for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1204
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1205
 * Open a file for writing, in platform-independent notation and in relation
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1206
 *  to the write dir as the root of the writable filesystem. The specified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1207
 *  file is created if it doesn't exist. If it does exist, it is truncated to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1208
 *  zero bytes, and the writing offset is set to the start.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1209
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1210
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1211
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1212
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1213
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1214
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1215
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1216
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1217
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1218
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1219
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1220
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1221
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1222
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1223
PHYSFS_DECL PHYSFS_File *PHYSFS_openWrite(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1224
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1225
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1226
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1227
 * \fn PHYSFS_File *PHYSFS_openAppend(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1228
 * \brief Open a file for appending.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1229
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1230
 * Open a file for writing, in platform-independent notation and in relation
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1231
 *  to the write dir as the root of the writable filesystem. The specified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1232
 *  file is created if it doesn't exist. If it does exist, the writing offset
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1233
 *  is set to the end of the file, so the first write will be the byte after
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1234
 *  the end.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1235
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1236
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1237
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1238
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1239
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1240
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1241
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1242
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1243
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1244
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1245
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1246
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1247
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1248
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1249
PHYSFS_DECL PHYSFS_File *PHYSFS_openAppend(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1250
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1252
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1253
 * \fn PHYSFS_File *PHYSFS_openRead(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1254
 * \brief Open a file for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1255
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1256
 * Open a file for reading, in platform-independent notation. The search path
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1257
 *  is checked one at a time until a matching file is found, in which case an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1258
 *  abstract filehandle is associated with it, and reading may be done.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1259
 *  The reading offset is set to the first byte of the file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1260
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1261
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1262
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1263
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1264
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1265
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1266
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1267
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1268
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1269
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1270
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1271
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1272
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1273
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1274
PHYSFS_DECL PHYSFS_File *PHYSFS_openRead(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1275
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1276
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1277
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1278
 * \fn int PHYSFS_close(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1279
 * \brief Close a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1280
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1281
 * This call is capable of failing if the operating system was buffering
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1282
 *  writes to the physical media, and, now forced to write those changes to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1283
 *  physical media, can not store the data for some reason. In such a case,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1284
 *  the filehandle stays open. A well-written program should ALWAYS check the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1285
 *  return value from the close call in addition to every writing call!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1286
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1287
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1288
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1289
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1290
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1291
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1292
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1293
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1294
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1295
PHYSFS_DECL int PHYSFS_close(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1296
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1297
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1298
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1299
 * \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1300
 * \brief Read data from a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1301
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1302
 * The file must be opened for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1303
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1304
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_readBytes() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1305
 *             function just wraps it anyhow. This function never clarified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1306
 *             what would happen if you managed to read a partial object, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1307
 *             working at the byte level makes this cleaner for everyone,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1308
 *             especially now that PHYSFS_Io interfaces can be supplied by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1309
 *             application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1310
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1311
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1312
 *   \param buffer buffer to store read data into.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1313
 *   \param objSize size in bytes of objects being read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1314
 *   \param objCount number of (objSize) objects to read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1315
 *  \return number of objects read. PHYSFS_getLastError() can shed light on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1316
 *           the reason this might be < (objCount), as can PHYSFS_eof().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1317
 *            -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1318
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1319
 * \sa PHYSFS_readBytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1320
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1321
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1322
PHYSFS_DECL PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1323
                                      void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1324
                                      PHYSFS_uint32 objSize,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1325
                                      PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1326
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1327
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1328
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1329
 * \fn PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1330
 * \brief Write data to a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1331
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1332
 * The file must be opened for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1333
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1334
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_writeBytes() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1335
 *             function just wraps it anyhow. This function never clarified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1336
 *             what would happen if you managed to write a partial object, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1337
 *             working at the byte level makes this cleaner for everyone,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1338
 *             especially now that PHYSFS_Io interfaces can be supplied by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1339
 *             application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1340
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1341
 *   \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1342
 *   \param buffer buffer of bytes to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1343
 *   \param objSize size in bytes of objects being written to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1344
 *   \param objCount number of (objSize) objects to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1345
 *  \return number of objects written. PHYSFS_getLastError() can shed light on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1346
 *           the reason this might be < (objCount). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1347
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1348
 * \sa PHYSFS_writeBytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1349
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1350
PHYSFS_DECL PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1351
                                       const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1352
                                       PHYSFS_uint32 objSize,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1353
                                       PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1354
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1355
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1356
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1357
/* File position stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1358
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1359
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1360
 * \fn int PHYSFS_eof(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1361
 * \brief Check for end-of-file state on a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1362
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1363
 * Determine if the end of file has been reached in a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1364
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1365
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1366
 *  \return nonzero if EOF, zero if not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1367
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1368
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1369
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1370
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1371
PHYSFS_DECL int PHYSFS_eof(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1372
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1373
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1374
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1375
 * \fn PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1376
 * \brief Determine current position within a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1377
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1378
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1379
 *  \return offset in bytes from start of file. -1 if error occurred.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1380
 *           Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1381
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1382
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1383
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1384
PHYSFS_DECL PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1385
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1386
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1387
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1388
 * \fn int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1389
 * \brief Seek to a new position within a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1390
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1391
 * The next read or write will occur at that place. Seeking past the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1392
 *  beginning or end of the file is not allowed, and causes an error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1393
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1394
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1395
 *   \param pos number of bytes from start of file to seek to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1396
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1397
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1398
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1399
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1400
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1401
PHYSFS_DECL int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1402
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1403
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1404
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1405
 * \fn PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1406
 * \brief Get total length of a file in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1407
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1408
 * Note that if another process/thread is writing to this file at the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1409
 *  time, then the information this function supplies could be incorrect
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1410
 *  before you get it. Use with caution, or better yet, don't use at all.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1411
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1412
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1413
 *  \return size in bytes of the file. -1 if can't be determined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1414
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1415
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1416
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1417
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1418
PHYSFS_DECL PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1419
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1420
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1421
/* Buffering stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1422
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1423
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1424
 * \fn int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1425
 * \brief Set up buffering for a PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1426
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1427
 * Define an i/o buffer for a file handle. A memory block of (bufsize) bytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1428
 *  will be allocated and associated with (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1429
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1430
 * For files opened for reading, up to (bufsize) bytes are read from (handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1431
 *  and stored in the internal buffer. Calls to PHYSFS_read() will pull
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1432
 *  from this buffer until it is empty, and then refill it for more reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1433
 *  Note that compressed files, like ZIP archives, will decompress while
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1434
 *  buffering, so this can be handy for offsetting CPU-intensive operations.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1435
 *  The buffer isn't filled until you do your next read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1436
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1437
 * For files opened for writing, data will be buffered to memory until the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1438
 *  buffer is full or the buffer is flushed. Closing a handle implicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1439
 *  causes a flush...check your return values!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1440
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1441
 * Seeking, etc transparently accounts for buffering.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1442
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1443
 * You can resize an existing buffer by calling this function more than once
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1444
 *  on the same file. Setting the buffer size to zero will free an existing
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1445
 *  buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1446
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1447
 * PhysicsFS file handles are unbuffered by default.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1448
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1449
 * Please check the return value of this function! Failures can include
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1450
 *  not being able to seek backwards in a read-only file when removing the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1451
 *  buffer, not being able to allocate the buffer, and not being able to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1452
 *  flush the buffer to disk, among other unexpected problems.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1453
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1454
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1455
 *   \param bufsize size, in bytes, of buffer to allocate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1456
 *  \return nonzero if successful, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1457
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1458
 * \sa PHYSFS_flush
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1459
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1460
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1461
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1462
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1463
PHYSFS_DECL int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1464
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1465
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1466
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1467
 * \fn int PHYSFS_flush(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1468
 * \brief Flush a buffered PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1469
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1470
 * For buffered files opened for writing, this will put the current contents
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1471
 *  of the buffer to disk and flag the buffer as empty if possible.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1472
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1473
 * For buffered files opened for reading or unbuffered files, this is a safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1474
 *  no-op, and will report success.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1475
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1476
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1477
 *  \return nonzero if successful, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1478
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1479
 * \sa PHYSFS_setBuffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1480
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1481
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1482
PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1483
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1484
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1485
/* Byteorder stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1486
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1487
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1488
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1489
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1490
 * \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1491
 * \brief Swap littleendian signed 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1492
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1493
 * Take a 16-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1494
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1495
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1496
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1497
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1498
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1499
PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1500
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1501
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1502
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1503
 * \fn PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1504
 * \brief Swap littleendian unsigned 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1505
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1506
 * Take a 16-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1507
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1508
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1509
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1510
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1511
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1512
PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1513
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1514
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1515
 * \fn PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1516
 * \brief Swap littleendian signed 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1517
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1518
 * Take a 32-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1519
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1520
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1521
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1522
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1523
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1524
PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1525
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1526
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1527
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1528
 * \fn PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1529
 * \brief Swap littleendian unsigned 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1530
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1531
 * Take a 32-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1532
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1533
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1534
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1535
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1536
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1537
PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1538
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1539
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1540
 * \fn PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1541
 * \brief Swap littleendian signed 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1542
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1543
 * Take a 64-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1544
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1545
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1546
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1547
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1548
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1549
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1550
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1551
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1552
PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1553
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1554
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1555
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1556
 * \fn PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1557
 * \brief Swap littleendian unsigned 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1558
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1559
 * Take a 64-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1560
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1561
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1562
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1563
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1564
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1565
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1566
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1567
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1568
PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1569
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1570
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1571
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1572
 * \fn PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1573
 * \brief Swap bigendian signed 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1574
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1575
 * Take a 16-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1576
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1577
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1578
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1579
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1580
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1581
PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1582
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1583
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1584
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1585
 * \fn PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1586
 * \brief Swap bigendian unsigned 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1587
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1588
 * Take a 16-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1589
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1590
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1591
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1592
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1593
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1594
PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1595
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1596
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1597
 * \fn PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1598
 * \brief Swap bigendian signed 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1599
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1600
 * Take a 32-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1601
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1602
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1603
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1604
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1605
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1606
PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1607
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1608
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1609
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1610
 * \fn PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1611
 * \brief Swap bigendian unsigned 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1612
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1613
 * Take a 32-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1614
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1615
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1616
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1617
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1618
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1619
PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1620
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1621
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1622
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1623
 * \fn PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1624
 * \brief Swap bigendian signed 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1625
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1626
 * Take a 64-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1627
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1628
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1629
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1630
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1631
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1632
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1633
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1634
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1635
PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1636
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1637
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1638
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1639
 * \fn PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1640
 * \brief Swap bigendian unsigned 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1641
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1642
 * Take a 64-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1643
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1644
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1645
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1646
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1647
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1648
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1649
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1650
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1651
PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1652
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1653
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1654
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1655
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1656
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1657
 * \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1658
 * \brief Read and convert a signed 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1659
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1660
 * Convenience function. Read a signed 16-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1661
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1662
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1663
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1664
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1665
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1666
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1667
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1668
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1669
PHYSFS_DECL int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1670
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1671
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1672
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1673
 * \fn int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1674
 * \brief Read and convert an unsigned 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1675
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1676
 * Convenience function. Read an unsigned 16-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1677
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1678
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1679
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1680
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1681
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1682
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1683
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1684
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1685
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1686
PHYSFS_DECL int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1687
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1688
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1689
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1690
 * \fn int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1691
 * \brief Read and convert a signed 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1692
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1693
 * Convenience function. Read a signed 16-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1694
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1695
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1696
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1697
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1698
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1699
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1700
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1701
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1702
PHYSFS_DECL int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1703
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1704
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1705
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1706
 * \fn int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1707
 * \brief Read and convert an unsigned 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1708
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1709
 * Convenience function. Read an unsigned 16-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1710
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1711
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1712
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1713
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1714
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1715
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1716
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1717
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1718
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1719
PHYSFS_DECL int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1720
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1721
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1722
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1723
 * \fn int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1724
 * \brief Read and convert a signed 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1725
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1726
 * Convenience function. Read a signed 32-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1727
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1728
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1729
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1730
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1731
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1732
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1733
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1734
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1735
PHYSFS_DECL int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1736
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1737
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1738
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1739
 * \fn int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1740
 * \brief Read and convert an unsigned 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1741
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1742
 * Convenience function. Read an unsigned 32-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1743
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1744
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1745
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1746
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1747
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1748
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1749
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1750
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1751
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1752
PHYSFS_DECL int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1753
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1754
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1755
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1756
 * \fn int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1757
 * \brief Read and convert a signed 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1758
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1759
 * Convenience function. Read a signed 32-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1760
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1761
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1762
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1763
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1764
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1765
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1766
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1767
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1768
PHYSFS_DECL int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1769
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1770
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1771
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1772
 * \fn int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1773
 * \brief Read and convert an unsigned 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1774
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1775
 * Convenience function. Read an unsigned 32-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1776
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1777
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1778
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1779
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1780
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1781
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1782
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1783
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1784
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1785
PHYSFS_DECL int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1786
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1787
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1788
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1789
 * \fn int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1790
 * \brief Read and convert a signed 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1791
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1792
 * Convenience function. Read a signed 64-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1793
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1794
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1795
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1796
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1797
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1798
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1799
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1800
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1801
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1802
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1803
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1804
PHYSFS_DECL int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1805
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1806
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1807
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1808
 * \fn int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1809
 * \brief Read and convert an unsigned 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1810
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1811
 * Convenience function. Read an unsigned 64-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1812
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1813
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1814
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1815
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1816
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1817
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1818
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1819
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1820
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1821
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1822
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1823
PHYSFS_DECL int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1824
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1825
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1826
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1827
 * \fn int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1828
 * \brief Read and convert a signed 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1829
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1830
 * Convenience function. Read a signed 64-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1831
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1832
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1833
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1834
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1835
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1836
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1837
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1838
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1839
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1840
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1841
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1842
PHYSFS_DECL int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1843
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1844
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1845
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1846
 * \fn int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1847
 * \brief Read and convert an unsigned 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1848
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1849
 * Convenience function. Read an unsigned 64-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1850
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1851
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1852
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1853
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1854
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1855
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1856
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1857
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1858
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1859
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1860
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1861
PHYSFS_DECL int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1862
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1863
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1864
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1865
 * \fn int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1866
 * \brief Convert and write a signed 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1867
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1868
 * Convenience function. Convert a signed 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1869
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1870
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1871
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1872
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1873
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1874
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1875
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1876
PHYSFS_DECL int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1877
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1878
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1879
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1880
 * \fn int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1881
 * \brief Convert and write an unsigned 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1882
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1883
 * Convenience function. Convert an unsigned 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1884
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1885
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1886
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1887
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1888
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1889
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1890
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1891
PHYSFS_DECL int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1892
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1893
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1894
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1895
 * \fn int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1896
 * \brief Convert and write a signed 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1897
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1898
 * Convenience function. Convert a signed 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1899
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1900
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1901
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1902
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1903
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1904
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1905
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1906
PHYSFS_DECL int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1907
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1908
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1909
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1910
 * \fn int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1911
 * \brief Convert and write an unsigned 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1912
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1913
 * Convenience function. Convert an unsigned 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1914
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1915
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1916
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1917
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1918
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1919
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1920
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1921
PHYSFS_DECL int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1922
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1923
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1924
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1925
 * \fn int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1926
 * \brief Convert and write a signed 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1927
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1928
 * Convenience function. Convert a signed 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1929
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1930
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1931
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1932
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1933
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1934
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1935
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1936
PHYSFS_DECL int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1937
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1938
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1939
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1940
 * \fn int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1941
 * \brief Convert and write an unsigned 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1942
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1943
 * Convenience function. Convert an unsigned 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1944
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1945
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1946
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1947
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1948
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1949
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1950
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1951
PHYSFS_DECL int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1952
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1953
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1954
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1955
 * \fn int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1956
 * \brief Convert and write a signed 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1957
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1958
 * Convenience function. Convert a signed 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1959
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1960
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1961
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1962
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1963
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1964
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1965
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1966
PHYSFS_DECL int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1967
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1968
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1969
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1970
 * \fn int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1971
 * \brief Convert and write an unsigned 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1972
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1973
 * Convenience function. Convert an unsigned 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1974
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1975
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1976
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1977
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1978
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1979
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1980
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1981
PHYSFS_DECL int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1982
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1983
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1984
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1985
 * \fn int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1986
 * \brief Convert and write a signed 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1987
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1988
 * Convenience function. Convert a signed 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1989
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1990
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1991
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1992
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1993
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1994
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1995
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1996
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1997
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1998
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1999
PHYSFS_DECL int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2000
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2001
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2002
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2003
 * \fn int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2004
 * \brief Convert and write an unsigned 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2005
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2006
 * Convenience function. Convert an unsigned 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2007
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2008
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2009
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2010
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2011
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2012
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2013
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2014
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2015
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2016
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2017
PHYSFS_DECL int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2018
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2019
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2020
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2021
 * \fn int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2022
 * \brief Convert and write a signed 64-bit bigending value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2023
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2024
 * Convenience function. Convert a signed 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2025
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2026
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2027
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2028
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2029
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2030
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2031
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2032
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2033
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2034
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2035
PHYSFS_DECL int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2036
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2037
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2038
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2039
 * \fn int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2040
 * \brief Convert and write an unsigned 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2041
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2042
 * Convenience function. Convert an unsigned 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2043
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2044
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2045
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2046
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2047
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2048
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2049
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2050
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2051
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2052
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2053
PHYSFS_DECL int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2054
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2055
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2056
/* Everything above this line is part of the PhysicsFS 1.0 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2057
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2058
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2059
 * \fn int PHYSFS_isInit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2060
 * \brief Determine if the PhysicsFS library is initialized.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2061
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2062
 * Once PHYSFS_init() returns successfully, this will return non-zero.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2063
 *  Before a successful PHYSFS_init() and after PHYSFS_deinit() returns
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2064
 *  successfully, this will return zero. This function is safe to call at
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2065
 *  any time.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2066
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2067
 *  \return non-zero if library is initialized, zero if library is not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2068
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2069
 * \sa PHYSFS_init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2070
 * \sa PHYSFS_deinit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2071
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2072
PHYSFS_DECL int PHYSFS_isInit(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2073
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2074
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2075
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2076
 * \fn int PHYSFS_symbolicLinksPermitted(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2077
 * \brief Determine if the symbolic links are permitted.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2078
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2079
 * This reports the setting from the last call to PHYSFS_permitSymbolicLinks().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2080
 *  If PHYSFS_permitSymbolicLinks() hasn't been called since the library was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2081
 *  last initialized, symbolic links are implicitly disabled.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2082
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2083
 *  \return non-zero if symlinks are permitted, zero if not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2084
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2085
 * \sa PHYSFS_permitSymbolicLinks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2086
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2087
PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2088
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2089
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2090
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2091
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2092
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2093
 * \struct PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2094
 * \brief PhysicsFS allocation function pointers.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2095
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2096
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2097
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2098
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2099
 * You create one of these structures for use with PHYSFS_setAllocator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2100
 *  Allocators are assumed to be reentrant by the caller; please mutex
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2101
 *  accordingly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2102
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2103
 * Allocations are always discussed in 64-bits, for future expansion...we're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2104
 *  on the cusp of a 64-bit transition, and we'll probably be allocating 6
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2105
 *  gigabytes like it's nothing sooner or later, and I don't want to change
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2106
 *  this again at that point. If you're on a 32-bit platform and have to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2107
 *  downcast, it's okay to return NULL if the allocation is greater than
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2108
 *  4 gigabytes, since you'd have to do so anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2109
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2110
 * \sa PHYSFS_setAllocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2111
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2112
typedef struct PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2113
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2114
    int (*Init)(void);   /**< Initialize. Can be NULL. Zero on failure. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2115
    void (*Deinit)(void);  /**< Deinitialize your allocator. Can be NULL. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2116
    void *(*Malloc)(PHYSFS_uint64);  /**< Allocate like malloc(). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2117
    void *(*Realloc)(void *, PHYSFS_uint64); /**< Reallocate like realloc(). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2118
    void (*Free)(void *); /**< Free memory from Malloc or Realloc. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2119
} PHYSFS_Allocator;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2120
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2121
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2122
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2123
 * \fn int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2124
 * \brief Hook your own allocation routines into PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2125
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2126
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2127
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2128
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2129
 * By default, PhysicsFS will use whatever is reasonable for a platform
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2130
 *  to manage dynamic memory (usually ANSI C malloc/realloc/free, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2131
 *  some platforms might use something else), but in some uncommon cases, the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2132
 *  app might want more control over the library's memory management. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2133
 *  lets you redirect PhysicsFS to use your own allocation routines instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2134
 *  You can only call this function before PHYSFS_init(); if the library is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2135
 *  initialized, it'll reject your efforts to change the allocator mid-stream.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2136
 *  You may call this function after PHYSFS_deinit() if you are willing to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2137
 *  shut down the library and restart it with a new allocator; this is a safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2138
 *  and supported operation. The allocator remains intact between deinit/init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2139
 *  calls. If you want to return to the platform's default allocator, pass a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2140
 *  NULL in here.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2141
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2142
 * If you aren't immediately sure what to do with this function, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2143
 *  safely ignore it altogether.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2144
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2145
 *    \param allocator Structure containing your allocator's entry points.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2146
 *   \return zero on failure, non-zero on success. This call only fails
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2147
 *           when used between PHYSFS_init() and PHYSFS_deinit() calls.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2148
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2149
PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2150
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2151
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2152
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2153
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2154
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2155
 * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2156
 * \brief Add an archive or directory to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2157
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2158
 * If this is a duplicate, the entry is not added again, even though the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2159
 *  function succeeds. You may not add the same archive to two different
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2160
 *  mountpoints: duplicate checking is done against the archive and not the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2161
 *  mountpoint.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2162
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2163
 * When you mount an archive, it is added to a virtual file system...all files
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2164
 *  in all of the archives are interpolated into a single hierachical file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2165
 *  tree. Two archives mounted at the same place (or an archive with files
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2166
 *  overlapping another mountpoint) may have overlapping files: in such a case,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2167
 *  the file earliest in the search path is selected, and the other files are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2168
 *  inaccessible to the application. This allows archives to be used to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2169
 *  override previous revisions; you can use the mounting mechanism to place
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2170
 *  archives at a specific point in the file tree and prevent overlap; this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2171
 *  is useful for downloadable mods that might trample over application data
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2172
 *  or each other, for example.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2173
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2174
 * The mountpoint does not need to exist prior to mounting, which is different
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2175
 *  than those familiar with the Unix concept of "mounting" may not expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2176
 *  As well, more than one archive can be mounted to the same mountpoint, or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2177
 *  mountpoints and archive contents can overlap...the interpolation mechanism
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2178
 *  still functions as usual.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2179
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2180
 *   \param newDir directory or archive to add to the path, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2181
 *                   platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2182
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2183
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2184
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2185
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2186
 *  \return nonzero if added to path, zero on failure (bogus archive, dir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2187
 *                   missing, etc). Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2188
 *                   gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2189
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2190
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2191
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2192
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2193
 * \sa PHYSFS_mountIo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2194
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2195
PHYSFS_DECL int PHYSFS_mount(const char *newDir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2196
                             const char *mountPoint,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2197
                             int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2198
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2199
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2200
 * \fn int PHYSFS_getMountPoint(const char *dir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2201
 * \brief Determine a mounted archive's mountpoint.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2202
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2203
 * You give this function the name of an archive or dir you successfully
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2204
 *  added to the search path, and it reports the location in the interpolated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2205
 *  tree where it is mounted. Files mounted with a NULL mountpoint or through
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2206
 *  PHYSFS_addToSearchPath() will report "/". The return value is READ ONLY
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2207
 *  and valid until the archive is removed from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2208
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2209
 *   \param dir directory or archive previously added to the path, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2210
 *              platform-dependent notation. This must match the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2211
 *              used when adding, even if your string would also reference
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2212
 *              the same file with a different string of characters.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2213
 *  \return READ-ONLY string of mount point if added to path, NULL on failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2214
 *          (bogus archive, etc) Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2215
 *          PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2216
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2217
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2218
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2219
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2220
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2221
PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2222
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2223
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2224
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2225
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2226
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2227
 * \typedef PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2228
 * \brief Function signature for callbacks that report strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2229
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2230
 * These are used to report a list of strings to an original caller, one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2231
 *  string per callback. All strings are UTF-8 encoded. Functions should not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2232
 *  try to modify or free the string's memory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2233
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2234
 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2235
 *  functions that would return lists that need to be cleaned up with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2236
 *  PHYSFS_freeList(). The callback means that the library doesn't need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2237
 *  allocate an entire list and all the strings up front.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2238
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2239
 * Be aware that promises data ordering in the list versions are not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2240
 *  necessarily so in the callback versions. Check the documentation on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2241
 *  specific APIs, but strings may not be sorted as you expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2242
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2243
 *    \param data User-defined data pointer, passed through from the API
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2244
 *                that eventually called the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2245
 *    \param str The string data about which the callback is meant to inform.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2246
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2247
 * \sa PHYSFS_getCdRomDirsCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2248
 * \sa PHYSFS_getSearchPathCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2249
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2250
typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2252
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2253
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2254
 * \typedef PHYSFS_EnumFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2255
 * \brief Function signature for callbacks that enumerate files.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2256
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2257
 * These are used to report a list of directory entries to an original caller,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2258
 *  one file/dir/symlink per callback. All strings are UTF-8 encoded.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2259
 *  Functions should not try to modify or free any string's memory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2260
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2261
 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2262
 *  functions that would return lists that need to be cleaned up with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2263
 *  PHYSFS_freeList(). The callback means that the library doesn't need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2264
 *  allocate an entire list and all the strings up front.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2265
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2266
 * Be aware that promises data ordering in the list versions are not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2267
 *  necessarily so in the callback versions. Check the documentation on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2268
 *  specific APIs, but strings may not be sorted as you expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2269
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2270
 *    \param data User-defined data pointer, passed through from the API
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2271
 *                that eventually called the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2272
 *    \param origdir A string containing the full path, in platform-independent
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2273
 *                   notation, of the directory containing this file. In most
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2274
 *                   cases, this is the directory on which you requested
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2275
 *                   enumeration, passed in the callback for your convenience.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2276
 *    \param fname The filename that is being enumerated. It may not be in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2277
 *                 alphabetical order compared to other callbacks that have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2278
 *                 fired, and it will not contain the full path. You can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2279
 *                 recreate the fullpath with $origdir/$fname ... The file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2280
 *                 can be a subdirectory, a file, a symlink, etc.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2281
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2282
 * \sa PHYSFS_enumerateFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2283
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2284
typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2285
                                         const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2286
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2287
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2288
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2289
 * \fn void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2290
 * \brief Enumerate CD-ROM directories, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2291
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2292
 * Internally, PHYSFS_getCdRomDirs() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2293
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2294
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2295
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2296
 * Unlike PHYSFS_getCdRomDirs(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2297
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2298
 *  detected disc:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2299
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2300
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2301
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2302
 * static void foundDisc(void *data, const char *cddir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2303
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2304
 *     printf("cdrom dir [%s] is available.\n", cddir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2305
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2306
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2307
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2308
 * PHYSFS_getCdRomDirsCallback(foundDisc, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2309
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2310
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2311
 * This call may block while drives spin up. Be forewarned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2312
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2313
 *    \param c Callback function to notify about detected drives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2314
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2315
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2316
 * \sa PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2317
 * \sa PHYSFS_getCdRomDirs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2318
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2319
PHYSFS_DECL void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2320
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2321
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2322
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2323
 * \fn void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2324
 * \brief Enumerate the search path, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2325
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2326
 * Internally, PHYSFS_getSearchPath() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2327
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2328
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2329
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2330
 * Unlike PHYSFS_getSearchPath(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2331
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2332
 *  element of the search path:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2333
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2334
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2335
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2336
 * static void printSearchPath(void *data, const char *pathItem)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2337
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2338
 *     printf("[%s] is in the search path.\n", pathItem);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2339
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2340
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2341
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2342
 * PHYSFS_getSearchPathCallback(printSearchPath, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2343
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2344
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2345
 * Elements of the search path are reported in order search priority, so the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2346
 *  first archive/dir that would be examined when looking for a file is the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2347
 *  first element passed through the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2348
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2349
 *    \param c Callback function to notify about search path elements.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2350
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2351
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2352
 * \sa PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2353
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2354
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2355
PHYSFS_DECL void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2356
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2357
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2358
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2359
 * \fn void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2360
 * \brief Get a file listing of a search path's directory, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2361
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2362
 * Internally, PHYSFS_enumerateFiles() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2363
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2364
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2365
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2366
 * Unlike PHYSFS_enumerateFiles(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2367
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2368
 *  element of the search path:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2369
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2370
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2371
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2372
 * static void printDir(void *data, const char *origdir, const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2373
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2374
 *     printf(" * We've got [%s] in [%s].\n", fname, origdir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2375
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2376
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2377
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2378
 * PHYSFS_enumerateFilesCallback("/some/path", printDir, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2379
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2380
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2381
 * !!! FIXME: enumerateFiles() does not promise alphabetical sorting by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2382
 * !!! FIXME:  case-sensitivity in the code, and doesn't promise sorting at
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2383
 * !!! FIXME:  all in the above docs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2384
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2385
 * Items sent to the callback are not guaranteed to be in any order whatsoever.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2386
 *  There is no sorting done at this level, and if you need that, you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2387
 *  probably use PHYSFS_enumerateFiles() instead, which guarantees
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2388
 *  alphabetical sorting. This form reports whatever is discovered in each
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2389
 *  archive before moving on to the next. Even within one archive, we can't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2390
 *  guarantee what order it will discover data. <em>Any sorting you find in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2391
 *  these callbacks is just pure luck. Do not rely on it.</em> As this walks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2392
 *  the entire list of archives, you may receive duplicate filenames.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2393
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2394
 *    \param dir Directory, in platform-independent notation, to enumerate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2395
 *    \param c Callback function to notify about search path elements.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2396
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2397
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2398
 * \sa PHYSFS_EnumFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2399
 * \sa PHYSFS_enumerateFiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2400
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2401
PHYSFS_DECL void PHYSFS_enumerateFilesCallback(const char *dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2402
                                               PHYSFS_EnumFilesCallback c,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2403
                                               void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2404
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2405
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2406
 * \fn void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2407
 * \brief Convert a UCS-4 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2408
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2409
 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2410
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2411
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2412
 *  please allocate a buffer that is the same size as the source buffer. UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2413
 *  never uses more than 32-bits per character, so while it may shrink a UCS-4
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2414
 *  string, it will never expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2415
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2416
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2417
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2418
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2419
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2420
 *   \param src Null-terminated source string in UCS-4 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2421
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2422
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2423
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2424
PHYSFS_DECL void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2425
                                     PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2426
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2427
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2428
 * \fn void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2429
 * \brief Convert a UTF-8 string to a UCS-4 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2430
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2431
 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2432
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2433
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2434
 *  please allocate a buffer that is four times the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2435
 *  UTF-8 uses from one to four bytes per character, but UCS-4 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2436
 *  four, so an entirely low-ASCII string will quadruple in size!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2437
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2438
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2439
 *  will always be null-terminated and never have an incomplete UCS-4
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2440
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2441
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2442
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2443
 *   \param dst Buffer to store converted UCS-4 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2444
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2445
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2446
PHYSFS_DECL void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2447
                                   PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2448
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2449
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2450
 * \fn void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2451
 * \brief Convert a UCS-2 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2452
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2453
 * \warning you almost certainly should use PHYSFS_utf8FromUtf16(), which
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2454
 *  became available in PhysicsFS 2.1, unless you know what you're doing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2455
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2456
 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2457
 *  with Unicode support. Please note that modern versions of Windows use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2458
 *  UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2459
 *  almost certainly want PHYSFS_utf8FromUtf16() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2460
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2461
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2462
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2463
 *  UTF-8 never uses more than 32-bits per character, so while it may shrink
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2464
 *  a UCS-2 string, it may also expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2465
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2466
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2467
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2468
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2469
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2470
 *   \param src Null-terminated source string in UCS-2 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2471
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2472
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2473
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2474
 * \sa PHYSFS_utf8FromUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2475
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2476
PHYSFS_DECL void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2477
                                     PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2478
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2479
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2480
 * \fn PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2481
 * \brief Convert a UTF-8 string to a UCS-2 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2482
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2483
 * \warning you almost certainly should use PHYSFS_utf8ToUtf16(), which
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2484
 *  became available in PhysicsFS 2.1, unless you know what you're doing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2485
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2486
 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2487
 *  with Unicode support. Please note that modern versions of Windows use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2488
 *  UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2489
 *  almost certainly want PHYSFS_utf8ToUtf16() instead, but you need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2490
 *  understand how that changes things, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2491
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2492
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2493
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2494
 *  UTF-8 uses from one to four bytes per character, but UCS-2 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2495
 *  two, so an entirely low-ASCII string will double in size!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2496
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2497
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2498
 *  will always be null-terminated and never have an incomplete UCS-2
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2499
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2500
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2501
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2502
 *   \param dst Buffer to store converted UCS-2 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2503
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2504
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2505
 * \sa PHYSFS_utf8ToUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2506
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2507
PHYSFS_DECL void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2508
                                   PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2509
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2510
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2511
 * \fn void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2512
 * \brief Convert a UTF-8 string to a Latin1 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2513
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2514
 * Latin1 strings are 8-bits per character: a popular "high ASCII" encoding.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2515
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2516
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2517
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2518
 *  UTF-8 expands latin1 codepoints over 127 from 1 to 2 bytes, so the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2519
 *  may grow in some cases.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2520
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2521
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2522
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2523
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2524
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2525
 * Please note that we do not supply a UTF-8 to Latin1 converter, since Latin1
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2526
 *  can't express most Unicode codepoints. It's a legacy encoding; you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2527
 *  be converting away from it at all times.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2528
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2529
 *   \param src Null-terminated source string in Latin1 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2530
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2531
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2532
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2533
PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2534
                                       PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2535
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2536
/* Everything above this line is part of the PhysicsFS 2.0 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2537
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2538
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2539
 * \fn int PHYSFS_unmount(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2540
 * \brief Remove a directory or archive from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2541
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2542
 * This is functionally equivalent to PHYSFS_removeFromSearchPath(), but that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2543
 *  function is deprecated to keep the vocabulary paired with PHYSFS_mount().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2544
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2545
 * This must be a (case-sensitive) match to a dir or archive already in the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2546
 *  search path, specified in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2547
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2548
 * This call will fail (and fail to remove from the path) if the element still
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2549
 *  has files open in it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2550
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2551
 *    \param oldDir dir/archive to remove.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2552
 *   \return nonzero on success, zero on failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2553
 *            Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2554
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2555
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2556
 * \sa PHYSFS_mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2557
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2558
PHYSFS_DECL int PHYSFS_unmount(const char *oldDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2559
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2560
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2561
 * \fn const PHYSFS_Allocator *PHYSFS_getAllocator(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2562
 * \brief Discover the current allocator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2563
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2564
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2565
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2566
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2567
 * This function exposes the function pointers that make up the currently used
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2568
 *  allocator. This can be useful for apps that want to access PhysicsFS's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2569
 *  internal, default allocation routines, as well as for external code that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2570
 *  wants to share the same allocator, even if the application specified their
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2571
 *  own.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2572
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2573
 * This call is only valid between PHYSFS_init() and PHYSFS_deinit() calls;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2574
 *  it will return NULL if the library isn't initialized. As we can't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2575
 *  guarantee the state of the internal allocators unless the library is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2576
 *  initialized, you shouldn't use any allocator returned here after a call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2577
 *  to PHYSFS_deinit().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2578
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2579
 * Do not call the returned allocator's Init() or Deinit() methods under any
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2580
 *  circumstances.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2581
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2582
 * If you aren't immediately sure what to do with this function, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2583
 *  safely ignore it altogether.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2584
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2585
 *  \return Current allocator, as set by PHYSFS_setAllocator(), or PhysicsFS's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2586
 *          internal, default allocator if no application defined allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2587
 *          is currently set. Will return NULL if the library is not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2588
 *          initialized.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2589
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2590
 * \sa PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2591
 * \sa PHYSFS_setAllocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2592
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2593
PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2594
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2595
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2596
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2597
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2598
 * \enum PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2599
 * \brief Type of a File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2600
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2601
 * Possible types of a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2602
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2603
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2604
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2605
typedef enum PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2606
{
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2607
    PHYSFS_FILETYPE_REGULAR, /**< a normal file */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2608
    PHYSFS_FILETYPE_DIRECTORY, /**< a directory */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2609
    PHYSFS_FILETYPE_SYMLINK, /**< a symlink */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2610
    PHYSFS_FILETYPE_OTHER /**< something completely different like a device */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2611
} PHYSFS_FileType;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2612
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2613
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2614
 * \struct PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2615
 * \brief Meta data for a file or directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2616
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2617
 * Container for various meta data about a file in the virtual file system.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2618
 *  PHYSFS_stat() uses this structure for returning the information. The time
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2619
 *  data will be either the number of seconds since the Unix epoch (midnight,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2620
 *  Jan 1, 1970), or -1 if the information isn't available or applicable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2621
 *  The (filesize) field is measured in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2622
 *  The (readonly) field tells you whether when you open a file for writing you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2623
 *  are writing to the same file as if you were opening it, given you have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2624
 *  enough filesystem rights to do that.  !!! FIXME: this might change.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2625
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2626
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2627
 * \sa PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2628
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2629
typedef struct PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2630
{
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2631
    PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2632
    PHYSFS_sint64 modtime;  /**< last modification time */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2633
    PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2634
    PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2635
    PHYSFS_FileType filetype; /**< File? Directory? Symlink? */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8524
diff changeset
  2636
    int readonly; /**< non-zero if read only, zero if writable. */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2637
} PHYSFS_Stat;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2638
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2639
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2640
 * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2641
 * \brief Get various information about a directory or a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2642
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2643
 * Obtain various information about a file or directory from the meta data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2644
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2645
 * This function will never follow symbolic links. If you haven't enabled
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2646
 *  symlinks with PHYSFS_permitSymbolicLinks(), stat'ing a symlink will be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2647
 *  treated like stat'ing a non-existant file. If symlinks are enabled,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2648
 *  stat'ing a symlink will give you information on the link itself and not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2649
 *  what it points to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2650
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2651
 *    \param fname filename to check, in platform-indepedent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2652
 *    \param stat pointer to structure to fill in with data about (fname).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2653
 *   \return non-zero on success, zero on failure. On failure, (stat)'s
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2654
 *           contents are undefined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2655
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2656
 * \sa PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2657
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2658
PHYSFS_DECL int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2659
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2660
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2661
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2662
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2663
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2664
 * \fn void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2665
 * \brief Convert a UTF-16 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2666
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2667
 * UTF-16 strings are 16-bits per character (except some chars, which are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2668
 *  32-bits): \c TCHAR on Windows, when building with Unicode support. Modern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2669
 *  Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2670
 *  only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2671
 *  are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2672
 *  aren't sure, you should be using UTF-16 at this point on Windows.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2673
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2674
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2675
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2676
 *  UTF-8 never uses more than 32-bits per character, so while it may shrink
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2677
 *  a UTF-16 string, it may also expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2678
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2679
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2680
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2681
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2682
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2683
 *   \param src Null-terminated source string in UTF-16 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2684
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2685
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2686
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2687
PHYSFS_DECL void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2688
                                      PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2689
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2690
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2691
 * \fn PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2692
 * \brief Convert a UTF-8 string to a UTF-16 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2693
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2694
 * UTF-16 strings are 16-bits per character (except some chars, which are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2695
 *  32-bits): \c TCHAR on Windows, when building with Unicode support. Modern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2696
 *  Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2697
 *  only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2698
 *  are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2699
 *  aren't sure, you should be using UTF-16 at this point on Windows.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2700
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2701
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2702
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2703
 *  UTF-8 uses from one to four bytes per character, but UTF-16 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2704
 *  two to four, so an entirely low-ASCII string will double in size! The
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2705
 *  UTF-16 characters that would take four bytes also take four bytes in UTF-8,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2706
 *  so you don't need to allocate 4x the space just in case: double will do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2707
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2708
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2709
 *  will always be null-terminated and never have an incomplete UTF-16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2710
 *  surrogate pair at the end. If the buffer length is 0, this function does
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2711
 *  nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2712
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2713
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2714
 *   \param dst Buffer to store converted UTF-16 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2715
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2716
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2717
 * \sa PHYSFS_utf8ToUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2718
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2719
PHYSFS_DECL void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2720
                                    PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2721
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2722
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2723
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2724
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2725
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2726
 * \fn PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2727
 * \brief Read bytes from a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2728
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2729
 * The file must be opened for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2730
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2731
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2732
 *   \param buffer buffer of at least (len) bytes to store read data into.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2733
 *   \param len number of bytes being read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2734
 *  \return number of bytes read. This may be less than (len); this does not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2735
 *          signify an error, necessarily (a short read may mean EOF).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2736
 *          PHYSFS_getLastError() can shed light on the reason this might
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2737
 *          be < (len), as can PHYSFS_eof(). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2738
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2739
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2740
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2741
PHYSFS_DECL PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2742
                                           PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2743
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2744
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2745
 * \fn PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2746
 * \brief Write data to a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2747
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2748
 * The file must be opened for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2749
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2750
 * Please note that while (len) is an unsigned 64-bit integer, you are limited
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2751
 *  to 63 bits (9223372036854775807 bytes), so we can return a negative value
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2752
 *  on error. If length is greater than 0x7FFFFFFFFFFFFFFF, this function will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2753
 *  immediately fail. For systems without a 64-bit datatype, you are limited
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2754
 *  to 31 bits (0x7FFFFFFF, or 2147483647 bytes). We trust most things won't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2755
 *  need to do multiple gigabytes of i/o in one call anyhow, but why limit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2756
 *  things?
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2757
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2758
 *   \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2759
 *   \param buffer buffer of (len) bytes to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2760
 *   \param len number of bytes being written to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2761
 *  \return number of bytes written. This may be less than (len); in the case
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2762
 *          of an error, the system may try to write as many bytes as possible,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2763
 *          so an incomplete write might occur. PHYSFS_getLastError() can shed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2764
 *          light on the reason this might be < (len). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2765
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2766
PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2767
                                            const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2768
                                            PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2769
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2770
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2771
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2772
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2773
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2774
 * \struct PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2775
 * \brief An abstract i/o interface.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2776
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2777
 * \warning This is advanced, hardcore stuff. You don't need this unless you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2778
 *          really know what you're doing. Most apps will not need this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2779
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2780
 * Historically, PhysicsFS provided access to the physical filesystem and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2781
 *  archives within that filesystem. However, sometimes you need more power
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2782
 *  than this. Perhaps you need to provide an archive that is entirely
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2783
 *  contained in RAM, or you need to bridge some other file i/o API to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2784
 *  PhysicsFS, or you need to translate the bits (perhaps you have a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2785
 *  a standard .zip file that's encrypted, and you need to decrypt on the fly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2786
 *  for the unsuspecting zip archiver).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2787
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2788
 * A PHYSFS_Io is the interface that Archivers use to get archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2789
 *  Historically, this has mapped to file i/o to the physical filesystem, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2790
 *  as of PhysicsFS 2.1, applications can provide their own i/o implementations
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2791
 *  at runtime.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2792
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2793
 * This interface isn't necessarily a good universal fit for i/o. There are a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2794
 *  few requirements of note:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2795
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2796
 *  - They only do blocking i/o (at least, for now).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2797
 *  - They need to be able to duplicate. If you have a file handle from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2798
 *    fopen(), you need to be able to create a unique clone of it (so we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2799
 *    have two handles to the same file that can both seek/read/etc without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2800
 *    stepping on each other).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2801
 *  - They need to know the size of their entire data set.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2802
 *  - They need to be able to seek and rewind on demand.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2803
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2804
 * ...in short, you're probably not going to write an HTTP implementation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2805
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2806
 * Thread safety: TO BE DECIDED.  !!! FIXME
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2807
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2808
 * \sa PHYSFS_mountIo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2809
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2810
typedef struct PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2811
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2812
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2813
     * \brief Binary compatibility information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2814
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2815
     * This must be set to zero at this time. Future versions of this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2816
     *  struct will increment this field, so we know what a given
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2817
     *  implementation supports. We'll presumably keep supporting older
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2818
     *  versions as we offer new features, though.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2819
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2820
    PHYSFS_uint32 version;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2821
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2822
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2823
     * \brief Instance data for this struct.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2824
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2825
     * Each instance has a pointer associated with it that can be used to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2826
     *  store anything it likes. This pointer is per-instance of the stream,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2827
     *  so presumably it will change when calling duplicate(). This can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2828
     *  deallocated during the destroy() method.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2829
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2830
    void *opaque;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2831
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2832
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2833
     * \brief Read more data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2834
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2835
     * Read (len) bytes from the interface, at the current i/o position, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2836
     *  store them in (buffer). The current i/o position should move ahead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2837
     *  by the number of bytes successfully read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2838
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2839
     * You don't have to implement this; set it to NULL if not implemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2840
     *  This will only be used if the file is opened for reading. If set to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2841
     *  NULL, a default implementation that immediately reports failure will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2842
     *  be used.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2843
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2844
     *   \param io The i/o instance to read from.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2845
     *   \param buf The buffer to store data into. It must be at least
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2846
     *                 (len) bytes long and can't be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2847
     *   \param len The number of bytes to read from the interface.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2848
     *  \return number of bytes read from file, 0 on EOF, -1 if complete
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2849
     *          failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2850
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2851
    PHYSFS_sint64 (*read)(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2852
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2853
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2854
     * \brief Write more data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2855
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2856
     * Write (len) bytes from (buffer) to the interface at the current i/o
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2857
     *  position. The current i/o position should move ahead by the number of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2858
     *  bytes successfully written.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2859
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2860
     * You don't have to implement this; set it to NULL if not implemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2861
     *  This will only be used if the file is opened for writing. If set to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2862
     *  NULL, a default implementation that immediately reports failure will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2863
     *  be used.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2864
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2865
     * You are allowed to buffer; a write can succeed here and then later
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2866
     *  fail when flushing. Note that PHYSFS_setBuffer() may be operating a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2867
     *  level above your i/o, so you should usually not implement your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2868
     *  own buffering routines.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2869
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2870
     *   \param io The i/o instance to write to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2871
     *   \param buffer The buffer to read data from. It must be at least
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2872
     *                 (len) bytes long and can't be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2873
     *   \param len The number of bytes to read from (buffer).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2874
     *  \return number of bytes written to file, -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2875
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2876
    PHYSFS_sint64 (*write)(struct PHYSFS_Io *io, const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2877
                           PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2878
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2879
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2880
     * \brief Move i/o position to a given byte offset from start.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2881
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2882
     * This method moves the i/o position, so the next read/write will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2883
     *  be of the byte at (offset) offset. Seeks past the end of file should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2884
     *  be treated as an error condition.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2885
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2886
     *   \param io The i/o instance to seek.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2887
     *   \param offset The new byte offset for the i/o position.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2888
     *  \return non-zero on success, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2889
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2890
    int (*seek)(struct PHYSFS_Io *io, PHYSFS_uint64 offset);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2891
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2892
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2893
     * \brief Report current i/o position.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2894
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2895
     * Return bytes offset, or -1 if you aren't able to determine. A failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2896
     *  will almost certainly be fatal to further use of this stream, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2897
     *  may not leave this unimplemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2898
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2899
     *   \param io The i/o instance to query.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2900
     *  \return The current byte offset for the i/o position, -1 if unknown.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2901
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2902
    PHYSFS_sint64 (*tell)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2903
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2904
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2905
     * \brief Determine size of the i/o instance's dataset.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2906
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2907
     * Return number of bytes available in the file, or -1 if you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2908
     *  aren't able to determine. A failure will almost certainly be fatal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2909
     *  to further use of this stream, so you may not leave this unimplemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2910
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2911
     *   \param io The i/o instance to query.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2912
     *  \return Total size, in bytes, of the dataset.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2913
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2914
    PHYSFS_sint64 (*length)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2915
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2916
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2917
     * \brief Duplicate this i/o instance.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2918
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2919
     *  // !!! FIXME: write me.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2920
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2921
     *   \param io The i/o instance to duplicate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2922
     *  \return A new value for a stream's (opaque) field, or NULL on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2923
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2924
    struct PHYSFS_Io *(*duplicate)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2925
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2926
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2927
     * \brief Flush resources to media, or wherever.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2928
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2929
     * This is the chance to report failure for writes that had claimed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2930
     *  success earlier, but still had a chance to actually fail. This method
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2931
     *  can be NULL if flushing isn't necessary.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2932
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2933
     * This function may be called before destroy(), as it can report failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2934
     *  and destroy() can not. It may be called at other times, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2935
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2936
     *   \param io The i/o instance to flush.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2937
     *  \return Zero on error, non-zero on success.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2938
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2939
    int (*flush)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2940
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2941
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2942
     * \brief Cleanup and deallocate i/o instance.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2943
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2944
     * Free associated resources, including (opaque) if applicable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2945
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2946
     * This function must always succeed: as such, it returns void. The
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2947
     *  system may call your flush() method before this. You may report
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2948
     *  failure there if necessary. This method may still be called if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2949
     *  flush() fails, in which case you'll have to abandon unflushed data
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2950
     *  and other failing conditions and clean up.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2951
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2952
     * Once this method is called for a given instance, the system will assume
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2953
     *  it is unsafe to touch that instance again and will discard any
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2954
     *  references to it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2955
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2956
     *   \param s The i/o instance to destroy.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2957
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2958
    void (*destroy)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2959
} PHYSFS_Io;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2960
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2961
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2962
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2963
 * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2964
 * \brief Add an archive, built on a PHYSFS_Io, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2965
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2966
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2967
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2968
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2969
 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2970
 *  instead of a pathname. Behind the scenes, PHYSFS_mount() calls this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2971
 *  function with a physical-filesystem-based PHYSFS_Io.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2972
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2973
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2974
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2975
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2976
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2977
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2978
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2979
 * (io) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2980
 *  unmounted, the system will call (io)->destroy(io), which will give you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2981
 *  a chance to free your resources.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2982
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2983
 * If this function fails, (io)->destroy(io) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2984
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2985
 *   \param io i/o instance for archive to add to the path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2986
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2987
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2988
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2989
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2990
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2991
 *  \return nonzero if added to path, zero on failure (bogus archive, stream
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2992
 *                   i/o issue, etc). Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2993
 *                   gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2994
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2995
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2996
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2997
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2998
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2999
PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3000
                               const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3001
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3002
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3003
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3004
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3005
 * \fn int PHYSFS_mountMemory(const void *ptr, PHYSFS_uint64 len, void (*del)(void *), const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3006
 * \brief Add an archive, contained in a memory buffer, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3007
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3008
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3009
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3010
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3011
 * This function operates just like PHYSFS_mount(), but takes a memory buffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3012
 *  instead of a pathname. This buffer contains all the data of the archive,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3013
 *  and is used instead of a real file in the physical filesystem.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3014
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3015
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3016
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3017
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3018
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3019
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3020
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3021
 * (ptr) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3022
 *  unmounted, the system will call (del)(ptr), which will notify you that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3023
 *  the system is done with the buffer, and give you a chance to free your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3024
 *  resources. (del) can be NULL, in which case the system will make no
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3025
 *  attempt to free the buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3026
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3027
 * If this function fails, (del) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3028
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3029
 *   \param ptr Address of the memory buffer containing the archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3030
 *   \param len Size of memory buffer, in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3031
 *   \param del A callback that triggers upon unmount. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3032
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3033
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3034
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3035
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3036
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3037
 *  \return nonzero if added to path, zero on failure (bogus archive, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3038
 *                  Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3039
 *                  PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3040
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3041
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3042
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3043
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3044
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3045
PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3046
                                   void (*del)(void *), const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3047
                                   const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3048
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3049
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3050
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3051
 * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3052
 * \brief Add an archive, contained in a PHYSFS_File handle, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3053
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3054
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3055
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3056
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3057
 * \warning Archives-in-archives may be very slow! While a PHYSFS_File can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3058
 *          seek even when the data is compressed, it may do so by rewinding
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3059
 *          to the start and decompressing everything before the seek point.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3060
 *          Normal archive usage may do a lot of seeking behind the scenes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3061
 *          As such, you might find normal archive usage extremely painful
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3062
 *          if mounted this way. Plan accordingly: if you, say, have a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3063
 *          self-extracting .zip file, and want to mount something in it,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3064
 *          compress the contents of the inner archive and make sure the outer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3065
 *          .zip file doesn't compress the inner archive too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3066
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3067
 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3068
 *  handle instead of a pathname. This handle contains all the data of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3069
 *  archive, and is used instead of a real file in the physical filesystem.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3070
 *  The PHYSFS_File may be backed by a real file in the physical filesystem,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3071
 *  but isn't necessarily. The most popular use for this is likely to mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3072
 *  archives stored inside other archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3073
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3074
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3075
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3076
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3077
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3078
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3079
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3080
 * (file) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3081
 *  unmounted, the system will call PHYSFS_close(file). If you need this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3082
 *  handle to survive, you will have to wrap this in a PHYSFS_Io and use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3083
 *  PHYSFS_mountIo() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3084
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3085
 * If this function fails, PHYSFS_close(file) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3086
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3087
 *   \param file The PHYSFS_File handle containing archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3088
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3089
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3090
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3091
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3092
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3093
 *  \return nonzero if added to path, zero on failure (bogus archive, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3094
 *                  Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3095
 *                  PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3096
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3097
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3098
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3099
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3100
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3101
PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3102
                                   const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3103
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3104
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3105
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3106
 * \enum PHYSFS_ErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3107
 * \brief Values that represent specific causes of failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3108
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3109
 * Most of the time, you should only concern yourself with whether a given
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3110
 *  operation failed or not, but there may be occasions where you plan to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3111
 *  handle a specific failure case gracefully, so we provide specific error
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3112
 *  codes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3113
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3114
 * Most of these errors are a little vague, and most aren't things you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3115
 *  fix...if there's a permission error, for example, all you can really do
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3116
 *  is pass that information on to the user and let them figure out how to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3117
 *  handle it. In most these cases, your program should only care that it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3118
 *  failed to accomplish its goals, and not care specifically why.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3119
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3120
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3121
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3122
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3123
typedef enum PHYSFS_ErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3124
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3125
    PHYSFS_ERR_OK,               /**< Success; no error.                    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3126
    PHYSFS_ERR_OTHER_ERROR,      /**< Error not otherwise covered here.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3127
    PHYSFS_ERR_OUT_OF_MEMORY,    /**< Memory allocation failed.             */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3128
    PHYSFS_ERR_NOT_INITIALIZED,  /**< PhysicsFS is not initialized.         */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3129
    PHYSFS_ERR_IS_INITIALIZED,   /**< PhysicsFS is already initialized.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3130
    PHYSFS_ERR_ARGV0_IS_NULL,    /**< Needed argv[0], but it is NULL.       */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3131
    PHYSFS_ERR_UNSUPPORTED,      /**< Operation or feature unsupported.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3132
    PHYSFS_ERR_PAST_EOF,         /**< Attempted to access past end of file. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3133
    PHYSFS_ERR_FILES_STILL_OPEN, /**< Files still open.                     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3134
    PHYSFS_ERR_INVALID_ARGUMENT, /**< Bad parameter passed to an function.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3135
    PHYSFS_ERR_NOT_MOUNTED,      /**< Requested archive/dir not mounted.    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3136
    PHYSFS_ERR_NO_SUCH_PATH,     /**< No such file, directory, or parent.   */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3137
    PHYSFS_ERR_SYMLINK_FORBIDDEN,/**< Symlink seen when not permitted.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3138
    PHYSFS_ERR_NO_WRITE_DIR,     /**< No write dir has been specified.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3139
    PHYSFS_ERR_OPEN_FOR_READING, /**< Wrote to a file opened for reading.   */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3140
    PHYSFS_ERR_OPEN_FOR_WRITING, /**< Read from a file opened for writing.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3141
    PHYSFS_ERR_NOT_A_FILE,       /**< Needed a file, got a directory (etc). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3142
    PHYSFS_ERR_READ_ONLY,        /**< Wrote to a read-only filesystem.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3143
    PHYSFS_ERR_CORRUPT,          /**< Corrupted data encountered.           */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3144
    PHYSFS_ERR_SYMLINK_LOOP,     /**< Infinite symbolic link loop.          */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3145
    PHYSFS_ERR_IO,               /**< i/o error (hardware failure, etc).    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3146
    PHYSFS_ERR_PERMISSION,       /**< Permission denied.                    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3147
    PHYSFS_ERR_NO_SPACE,         /**< No space (disk full, over quota, etc) */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3148
    PHYSFS_ERR_BAD_FILENAME,     /**< Filename is bogus/insecure.           */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3149
    PHYSFS_ERR_BUSY,             /**< Tried to modify a file the OS needs.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3150
    PHYSFS_ERR_DIR_NOT_EMPTY,    /**< Tried to delete dir with files in it. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3151
    PHYSFS_ERR_OS_ERROR          /**< Unspecified OS-level error.           */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3152
} PHYSFS_ErrorCode;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3153
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3154
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3155
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3156
 * \fn PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3157
 * \brief Get machine-readable error information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3158
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3159
 * Get the last PhysicsFS error message as an integer value. This will return
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3160
 *  PHYSFS_ERR_OK if there's been no error since the last call to this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3161
 *  function. Each thread has a unique error state associated with it, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3162
 *  each time a new error message is set, it will overwrite the previous one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3163
 *  associated with that thread. It is safe to call this function at anytime,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3164
 *  even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3165
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3166
 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3167
 *  thread-specific error state. Calling one will wipe out the other's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3168
 *  data. If you need both, call PHYSFS_getLastErrorCode(), then pass that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3169
 *  value to PHYSFS_getErrorByCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3170
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3171
 * Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3172
 *  given function failed; however, if you require more specifics, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3173
 *  try this function to glean information, if there's some specific problem
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3174
 *  you're expecting and plan to handle. But with most things that involve
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3175
 *  file systems, the best course of action is usually to give up, report the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3176
 *  problem to the user, and let them figure out what should be done about it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3177
 *  For that, you might prefer PHYSFS_getLastError() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3178
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3179
 *   \return Enumeration value that represents last reported error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3180
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3181
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3182
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3183
PHYSFS_DECL PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3184
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3185
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3186
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3187
 * \fn const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3188
 * \brief Get human-readable description string for a given error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3189
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3190
 * Get a static string, in UTF-8 format, that represents an English
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3191
 *  description of a given error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3192
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3193
 * This string is guaranteed to never change (although we may add new strings
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3194
 *  for new error codes in later versions of PhysicsFS), so you can use it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3195
 *  for keying a localization dictionary.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3196
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3197
 * It is safe to call this function at anytime, even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3198
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3199
 * These strings are meant to be passed on directly to the user.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3200
 *  Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3201
 *  given function failed, but not care about the specifics much.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3202
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3203
 * Do not attempt to free the returned strings; they are read-only and you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3204
 *  don't own their memory pages.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3205
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3206
 *   \param code Error code to convert to a string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3207
 *   \return READ ONLY string of requested error message, NULL if this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3208
 *           is not a valid PhysicsFS error code. Always check for NULL if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3209
 *           you might be looking up an error code that didn't exist in an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3210
 *           earlier version of PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3211
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3212
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3213
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3214
PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3215
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3216
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3217
 * \fn void PHYSFS_setErrorCode(PHYSFS_ErrorCode code)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3218
 * \brief Set the current thread's error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3219
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3220
 * This lets you set the value that will be returned by the next call to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3221
 *  PHYSFS_getLastErrorCode(). This will replace any existing error code,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3222
 *  whether set by your application or internally by PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3223
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3224
 * Error codes are stored per-thread; what you set here will not be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3225
 *  accessible to another thread.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3226
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3227
 * Any call into PhysicsFS may change the current error code, so any code you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3228
 *  set here is somewhat fragile, and thus you shouldn't build any serious
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3229
 *  error reporting framework on this function. The primary goal of this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3230
 *  function is to allow PHYSFS_Io implementations to set the error state,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3231
 *  which generally will be passed back to your application when PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3232
 *  makes a PHYSFS_Io call that fails internally.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3233
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3234
 * This function doesn't care if the error code is a value known to PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3235
 *  or not (but PHYSFS_getErrorByCode() will return NULL for unknown values).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3236
 *  The value will be reported unmolested by PHYSFS_getLastErrorCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3237
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3238
 *   \param code Error code to become the current thread's new error state.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3239
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3240
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3241
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3242
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3243
PHYSFS_DECL void PHYSFS_setErrorCode(PHYSFS_ErrorCode code);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3244
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3245
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3246
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3247
 * \fn const char *PHYSFS_getPrefDir(const char *org, const char *app)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3248
 * \brief Get the user-and-app-specific path where files can be written.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3249
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3250
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3251
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3252
 * Get the "pref dir". This is meant to be where users can write personal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3253
 *  files (preferences and save games, etc) that are specific to your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3254
 *  application. This directory is unique per user, per application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3255
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3256
 * This function will decide the appropriate location in the native filesystem,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3257
 *  create the directory if necessary, and return a string in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3258
 *  platform-dependent notation, suitable for passing to PHYSFS_setWriteDir().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3259
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3260
 * On Windows, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3261
 *  "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3262
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3263
 * On Linux, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3264
 *  "/home/bob/.local/share/My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3265
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3266
 * On Mac OS X, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3267
 *  "/Users/bob/Library/Application Support/My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3268
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3269
 * (etc.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3270
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3271
 * You should probably use the pref dir for your write dir, and also put it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3272
 *  near the beginning of your search path. Older versions of PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3273
 *  offered only PHYSFS_getUserDir() and left you to figure out where the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3274
 *  files should go under that tree. This finds the correct location
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3275
 *  for whatever platform, which not only changes between operating systems,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3276
 *  but also versions of the same operating system.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3277
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3278
 * You specify the name of your organization (if it's not a real organization,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3279
 *  your name or an Internet domain you own might do) and the name of your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3280
 *  application. These should be proper names.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3281
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3282
 * Both the (org) and (app) strings may become part of a directory name, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3283
 *  please follow these rules:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3284
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3285
 *    - Try to use the same org string (including case-sensitivity) for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3286
 *      all your applications that use this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3287
 *    - Always use a unique app string for each one, and make sure it never
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3288
 *      changes for an app once you've decided on it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3289
 *    - Unicode characters are legal, as long as it's UTF-8 encoded, but...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3290
 *    - ...only use letters, numbers, and spaces. Avoid punctuation like
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3291
 *      "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3292
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3293
 * The pointer returned by this function remains valid until you call this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3294
 *  function again, or call PHYSFS_deinit(). This is not necessarily a fast
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3295
 *  call, though, so you should call this once at startup and copy the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3296
 *  if you need it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3297
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3298
 * You should assume the path returned by this function is the only safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3299
 *  place to write files (and that PHYSFS_getUserDir() and PHYSFS_getBaseDir(),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3300
 *  while they might be writable, or even parents of the returned path, aren't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3301
 *  where you should be writing things).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3302
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3303
 *   \param org The name of your organization.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3304
 *   \param app The name of your application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3305
 *  \return READ ONLY string of user dir in platform-dependent notation. NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3306
 *          if there's a problem (creating directory failed, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3307
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3308
 * \sa PHYSFS_getBaseDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3309
 * \sa PHYSFS_getUserDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3310
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3311
PHYSFS_DECL const char *PHYSFS_getPrefDir(const char *org, const char *app);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3312
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3313
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3314
/* Everything above this line is part of the PhysicsFS 2.1 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3315
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3316
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3317
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3318
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3319
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3320
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3321
#endif  /* !defined _INCLUDE_PHYSFS_H_ */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3322
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3323
/* end of physfs.h ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3324