platform/skeleton.c
author Ryan C. Gordon <icculus@icculus.org>
Sun, 11 Mar 2007 22:50:53 +0000
changeset 818 e36f23f49042
parent 809 116b8fe30371
child 828 ee871d51510d
permissions -rw-r--r--
Now compiles everything whether we need it or not, removing whole files with #ifdefs...this will make it easier to "embed" this library in other projects or use a different build system: just push everything through the compiler with preprocessor defines for the parts you want/need...platform modules are determined automatically without the build system needing to intervene, so you just have to #define the archivers, etc that you want.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
 * Skeleton platform-dependent support routines for PhysicsFS.
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
 *
809
116b8fe30371 Renamed LICENSE to LICENSE.txt
Ryan C. Gordon <icculus@icculus.org>
parents: 808
diff changeset
     4
 * Please see the file LICENSE.txt in the source's root directory.
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
 *
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
 *  This file written by Ryan C. Gordon.
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
 */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
#error DO NOT COMPILE THIS. IT IS JUST A SKELETON EXAMPLE FILE.
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    11
#define __PHYSICSFS_INTERNAL__
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    12
#include "physfs_platforms.h"
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    13
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    14
#ifdef PHYSFS_PLATFORM_SKELETON
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    15
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    16
#include "physfs_internal.h"
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
const char *__PHYSFS_platformDirSeparator = ":";
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
int __PHYSFS_platformInit(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
    return(1);  /* always succeed. */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
} /* __PHYSFS_platformInit */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
int __PHYSFS_platformDeinit(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
    return(1);  /* always succeed. */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
} /* __PHYSFS_platformDeinit */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
657
dad3b5c307a9 Added callback APIs and ripped up the internals everywhere to use them.
Ryan C. Gordon <icculus@icculus.org>
parents: 596
diff changeset
    33
void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
} /* __PHYSFS_platformDetectAvailableCDs */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
} /* __PHYSFS_platformCalcBaseDir */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
char *__PHYSFS_platformGetUserName(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
} /* __PHYSFS_platformGetUserName */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
char *__PHYSFS_platformGetUserDir(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
} /* __PHYSFS_platformGetUserDir */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
    return(1);  /* single threaded. */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
} /* __PHYSFS_platformGetThreadID */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
int __PHYSFS_platformStricmp(const char *x, const char *y)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
} /* __PHYSFS_platformStricmp */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
596
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    68
int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 l)
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    69
{
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    70
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    71
} /* __PHYSFS_platformStrnicmp */
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    72
381b6ca0dd85 Added internal function __PHYSFS_platformStrnicmp().
Ryan C. Gordon <icculus@icculus.org>
parents: 240
diff changeset
    73
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
int __PHYSFS_platformExists(const char *fname)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
} /* __PHYSFS_platformExists */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
int __PHYSFS_platformIsSymLink(const char *fname)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
} /* __PHYSFS_platformIsSymlink */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
int __PHYSFS_platformIsDirectory(const char *fname)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
} /* __PHYSFS_platformIsDirectory */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
char *__PHYSFS_platformCvtToDependent(const char *prepend,
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
                                      const char *dirName,
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
                                      const char *append)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
} /* __PHYSFS_platformCvtToDependent */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
void __PHYSFS_platformTimeslice(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
} /* __PHYSFS_platformTimeslice */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
657
dad3b5c307a9 Added callback APIs and ripped up the internals everywhere to use them.
Ryan C. Gordon <icculus@icculus.org>
parents: 596
diff changeset
   105
void __PHYSFS_platformEnumerateFiles(const char *dirname,
dad3b5c307a9 Added callback APIs and ripped up the internals everywhere to use them.
Ryan C. Gordon <icculus@icculus.org>
parents: 596
diff changeset
   106
                                     int omitSymLinks,
754
e7cd7411eadf API BREAKAGE: Changed PHYSFS_enumerateFilesCallback() to pass the originally
Ryan C. Gordon <icculus@icculus.org>
parents: 747
diff changeset
   107
                                     PHYSFS_EnumFilesCallback callback,
e7cd7411eadf API BREAKAGE: Changed PHYSFS_enumerateFilesCallback() to pass the originally
Ryan C. Gordon <icculus@icculus.org>
parents: 747
diff changeset
   108
                                     const char *origdir,
657
dad3b5c307a9 Added callback APIs and ripped up the internals everywhere to use them.
Ryan C. Gordon <icculus@icculus.org>
parents: 596
diff changeset
   109
                                     void *callbackdata)
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
} /* __PHYSFS_platformEnumerateFiles */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
char *__PHYSFS_platformCurrentDir(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
} /* __PHYSFS_platformCurrentDir */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
char *__PHYSFS_platformRealPath(const char *path)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
} /* __PHYSFS_platformRealPath */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
int __PHYSFS_platformMkDir(const char *path)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
} /* __PHYSFS_platformMkDir */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
void *__PHYSFS_platformOpenRead(const char *filename)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
} /* __PHYSFS_platformOpenRead */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
void *__PHYSFS_platformOpenWrite(const char *filename)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
} /* __PHYSFS_platformOpenWrite */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
void *__PHYSFS_platformOpenAppend(const char *filename)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
} /* __PHYSFS_platformOpenAppend */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
                                    PHYSFS_uint32 size, PHYSFS_uint32 count)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
} /* __PHYSFS_platformRead */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
                                     PHYSFS_uint32 size, PHYSFS_uint32 count)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
} /* __PHYSFS_platformWrite */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
} /* __PHYSFS_platformSeek */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
} /* __PHYSFS_platformTell */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
} /* __PHYSFS_platformFileLength */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
int __PHYSFS_platformEOF(void *opaque)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
} /* __PHYSFS_platformEOF */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
int __PHYSFS_platformFlush(void *opaque)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
} /* __PHYSFS_platformFlush */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
int __PHYSFS_platformClose(void *opaque)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
} /* __PHYSFS_platformClose */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
int __PHYSFS_platformDelete(const char *path)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
} /* __PHYSFS_platformDelete */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
void *__PHYSFS_platformCreateMutex(void)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
} /* __PHYSFS_platformCreateMutex */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
void __PHYSFS_platformDestroyMutex(void *mutex)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
{
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
} /* __PHYSFS_platformDestroyMutex */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
int __PHYSFS_platformGrabMutex(void *mutex)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
{
156
f45e26b5f398 Added warning about potential infinite recursion between setError and grabMutex.
Ryan C. Gordon <icculus@icculus.org>
parents: 152
diff changeset
   219
    /* not implemented, but can't call __PHYSFS_setError! */
f45e26b5f398 Added warning about potential infinite recursion between setError and grabMutex.
Ryan C. Gordon <icculus@icculus.org>
parents: 152
diff changeset
   220
    return(0);
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
} /* __PHYSFS_platformGrabMutex */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
void __PHYSFS_platformReleaseMutex(void *mutex)
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
{
156
f45e26b5f398 Added warning about potential infinite recursion between setError and grabMutex.
Ryan C. Gordon <icculus@icculus.org>
parents: 152
diff changeset
   226
    /* not implemented, but can't call __PHYSFS_setError! */
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
} /* __PHYSFS_platformReleaseMutex */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
240
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   229
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   230
PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   231
{
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   232
    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   233
} /* __PHYSFS_platformGetLastModTime */
052041af9001 Added PHYSFS_getLastModTime() API. (Thanks, John Hall!)
Ryan C. Gordon <icculus@icculus.org>
parents: 214
diff changeset
   234
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   235
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   236
int __PHYSFS_platformAllocatorInit(void)
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   237
{
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   238
    return(1);  /* always succeeds. */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   239
} /* __PHYSFS_platformAllocatorInit */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   240
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   241
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   242
void __PHYSFS_platformAllocatorDeinit(void)
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   243
{
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   244
    /* no-op */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   245
} /* __PHYSFS_platformAllocatorInit */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   246
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   247
747
3da194b12f43 Don't use size_t in physfs.h, since it relies on C runtime headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 691
diff changeset
   248
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   249
{
763
efadd9cdb6a4 Cleaned up overflow checks in platform memory allocators (thanks to Nicolas
Ryan C. Gordon <icculus@icculus.org>
parents: 754
diff changeset
   250
    BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   251
    #undef malloc
747
3da194b12f43 Don't use size_t in physfs.h, since it relies on C runtime headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 691
diff changeset
   252
    return(malloc((size_t) s));
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   253
} /* __PHYSFS_platformMalloc */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   254
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   255
747
3da194b12f43 Don't use size_t in physfs.h, since it relies on C runtime headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 691
diff changeset
   256
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   257
{
763
efadd9cdb6a4 Cleaned up overflow checks in platform memory allocators (thanks to Nicolas
Ryan C. Gordon <icculus@icculus.org>
parents: 754
diff changeset
   258
    BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   259
    #undef realloc
747
3da194b12f43 Don't use size_t in physfs.h, since it relies on C runtime headers.
Ryan C. Gordon <icculus@icculus.org>
parents: 691
diff changeset
   260
    return(realloc(ptr, (size_t) s));
691
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   261
} /* __PHYSFS_platformRealloc */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   262
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   263
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   264
void __PHYSFS_platformAllocatorFree(void *ptr)
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   265
{
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   266
    #undef free
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   267
    free(ptr);
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   268
} /* __PHYSFS_platformAllocatorFree */
71d9affe0d8a All memory management now goes through allocation hooks instead of directly to
Ryan C. Gordon <icculus@icculus.org>
parents: 657
diff changeset
   269
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   270
#endif  /* PHYSFS_PLATFORM_SKELETON */
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   271
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   272
152
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
/* end of skeleton.c ... */
14927fc344b0 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274