extras/physfs_rb/physfs/physfsrwops.h
author Ryan C. Gordon <icculus@icculus.org>
Sun, 01 Jan 2006 12:31:34 +0000
branchstable-1.0
changeset 766 3970811e14f4
parent 514 f4e89d934fee
child 1024 199e38498938
permissions -rw-r--r--
Changed my email address.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
514
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
 * This code provides a glue layer between PhysicsFS and Simple Directmedia
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
 *  Layer's (SDL) RWops i/o abstraction.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
 * License: this code is public domain. I make no warranty that it is useful,
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
 *  correct, harmless, or environmentally safe.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
 * This particular file may be used however you like, including copying it
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
 *  verbatim into a closed-source project, exploiting it commercially, and
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
 *  removing any trace of my name from the source (although I hope you won't
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
 *  do that). I welcome enhancements and corrections to this file, but I do
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
 *  not require you to send me patches if you make changes.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
 * Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
 *  General Public License: http://www.gnu.org/licenses/lgpl.txt
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
 * SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
 *
766
3970811e14f4 Changed my email address.
Ryan C. Gordon <icculus@icculus.org>
parents: 514
diff changeset
    19
 *  This file was written by Ryan C. Gordon. (icculus@icculus.org).
514
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
#ifndef _INCLUDE_PHYSFSRWOPS_H_
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
#define _INCLUDE_PHYSFSRWOPS_H_
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
#include "physfs.h"
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
#include "SDL.h"
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
#ifdef __cplusplus
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
extern "C" {
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#endif
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
/**
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
 * Open a platform-independent filename for reading, and make it accessible
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
 *  RWops is closed. PhysicsFS should be configured to your liking before
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
 *  opening files through this method.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
 *   @param filename File to open in platform-independent notation.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
 *           of the error can be gleaned from PHYSFS_getLastError().
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
/**
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
 * Open a platform-independent filename for writing, and make it accessible
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
 *  RWops is closed. PhysicsFS should be configured to your liking before
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
 *  opening files through this method.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
 *   @param filename File to open in platform-independent notation.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
 *           of the error can be gleaned from PHYSFS_getLastError().
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
/**
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
 * Open a platform-independent filename for appending, and make it accessible
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
 *  RWops is closed. PhysicsFS should be configured to your liking before
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
 *  opening files through this method.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
 *   @param filename File to open in platform-independent notation.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
 *           of the error can be gleaned from PHYSFS_getLastError().
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
/**
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
 * Make a SDL_RWops from an existing PhysicsFS file handle. You should
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
 *  dispose of any references to the handle after successful creation of
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
 *  the RWops. The actual PhysicsFS handle will be destroyed when the
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
 *  RWops is closed.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
 *   @param handle a valid PhysicsFS file handle.
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
 *           of the error can be gleaned from PHYSFS_getLastError().
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
#ifdef __cplusplus
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
#endif
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
#endif /* include-once blocker */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
/* end of physfsrwops.h ... */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87