extras/physfs_rb/physfs/rb_physfs.c
author Ryan C. Gordon <icculus@icculus.org>
Wed, 11 Dec 2002 15:37:23 +0000
changeset 514 f4e89d934fee
child 654 c0ae01de361d
permissions -rw-r--r--
Initial import of Ruby bindings for PhysicsFS.
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
 * PhysicsFS - ruby interface
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
 * 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
 * Author::  Ed Sinjiashvili (slimb@vlinkmail.com)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
 * License:: LGPL
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
 */
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
#include "physfs.h"
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
#include "ruby.h"
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
#include "rb_physfs.h" 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
#include "rb_physfs_file.h"
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
VALUE modulePhysfs;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
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
 * PhysicsFS::init str
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
 * initialize PhysicsFS
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
VALUE physfs_init (VALUE self, VALUE str)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
    int result = PHYSFS_init (STR2CSTR(str));
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
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
	return Qtrue;
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
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
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
 * PhysicsFS::deinit
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
VALUE physfs_deinit (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
    if (PHYSFS_deinit ())
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
	return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
}
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
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
 * PhysicsFS::version
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
 * return PhysicsFS::Version object
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
VALUE physfs_version (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
    char evalStr[200];
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
    PHYSFS_Version ver;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    PHYSFS_getLinkedVersion (&ver);
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
    sprintf (evalStr, "PhysicsFS::Version.new %d, %d, %d", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
	     ver.major, ver.minor, ver.patch);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
    return rb_eval_string (evalStr);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
 * PhysicsFS::supported_archives
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
 * return Array of PhysicsFS::ArchiveInfo objects
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
VALUE physfs_supported_archives (VALUE self)
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
    const PHYSFS_ArchiveInfo **info = PHYSFS_supportedArchiveTypes();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
    VALUE klass = rb_const_get (modulePhysfs, rb_intern ("ArchiveInfo"));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
    VALUE ary = rb_ary_new ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
    VALUE params[4];
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    while ( *info != 0 ) 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    {
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
        params[0] = rb_str_new2 ((*info)->extension);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
        params[1] = rb_str_new2 ((*info)->description);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
        params[2] = rb_str_new2 ((*info)->author);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
        params[3] = rb_str_new2 ((*info)->url);
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
        rb_ary_push (ary, rb_class_new_instance (4, params, klass));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
        info++;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
    }
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
    return ary;
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
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
 * PhysicsFS::last_error
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
 * return string representation of last PhysicsFS error
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
VALUE physfs_last_error (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
    const char *last_error = PHYSFS_getLastError ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    if (last_error == 0)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
	last_error = "";
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
    return rb_str_new2 (last_error);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
 * PhysicsFS::dir_separator
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
 * return platform directory separator
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
VALUE physfs_dir_separator (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
    return rb_str_new2 (PHYSFS_getDirSeparator ());
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
 * PhysicsFS::permit_symlinks boolValue
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
 * turn symlinks support on/off
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
VALUE physfs_permit_symlinks (VALUE self, VALUE allow)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
    int p = 1;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
    
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
    if (allow == Qfalse || allow == Qnil)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
        p = 0;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
    PHYSFS_permitSymbolicLinks (p);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
 * PhysicsFS::cdrom_dirs
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
 * return Array of strings containing available CDs 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
VALUE physfs_cdrom_dirs (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
    char **cds = PHYSFS_getCdRomDirs();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
    char **i;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
    VALUE ary = rb_ary_new ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
    for (i = cds; *i != 0; i++)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
        rb_ary_push (ary, rb_str_new2 (*i));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    PHYSFS_freeList (cds);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
    return ary;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
 * PhysicsFS::base_dir
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
 * return base directory
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
VALUE physfs_base_dir (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
    const char *base_dir = PHYSFS_getBaseDir ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
    if (base_dir == 0)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
        base_dir = "";
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
    return rb_str_new2 (base_dir);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
 * PhysicsFS::user_dir
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
 * return user directory
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
VALUE physfs_user_dir (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
    const char *user_dir = PHYSFS_getBaseDir ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
    if (user_dir == 0)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
        user_dir = "";
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
    return rb_str_new2 (user_dir);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
   
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
 * PhysicsFS::write_dir 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
 * return write directory
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
VALUE physfs_write_dir (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
    const char *write_dir = PHYSFS_getWriteDir ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
    if (write_dir == 0)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
        return Qnil;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
    return rb_str_new2 (write_dir);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
 * PhysicsFS::write_dir= str
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
 * set write directory to *str*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
VALUE physfs_set_write_dir (VALUE self, VALUE str)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
    int result = PHYSFS_setWriteDir (STR2CSTR(str));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
 * PhysicsFS::add_to_search_path str, append
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
 * if append > 0 - append str to search path, otherwise prepend it
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
VALUE physfs_add_search_path (VALUE self, VALUE str, VALUE append)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
    int result = PHYSFS_addToSearchPath (STR2CSTR(str), FIX2INT(append));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
 * PhysicsFS::remove_from_search_path str
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
 * removes str from search path
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
VALUE physfs_remove_search_path (VALUE self, VALUE str)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
    int result = PHYSFS_removeFromSearchPath (STR2CSTR(str));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
 * PhysicsFS::search_path
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
 * return current search_path - as array of strings
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
VALUE physfs_search_path (VALUE self)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
    char **path = PHYSFS_getSearchPath ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
    char **i;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
    VALUE ary = rb_ary_new ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
    for (i = path ; *i != 0; i++)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
        rb_ary_push (ary, rb_str_new2 (*i));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
    PHYSFS_freeList (path);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
    return ary;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
// 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
VALUE physfs_setSaneConfig(VALUE self, VALUE org, VALUE app, VALUE ext,
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   246
                           VALUE includeCdroms, VALUE archivesFirst)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   247
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   248
    int res = PHYSFS_setSaneConfig (STR2CSTR(org), STR2CSTR(app), STR2CSTR(ext),
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   249
                                   RTEST(includeCdroms), RTEST(archivesFirst));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   250
    if (res)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   251
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   253
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   254
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   255
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   257
 * PhysicsFS::mkdir newdir
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   258
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
 * create new directory 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   260
 */ 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   261
VALUE physfs_mkdir (VALUE self, VALUE newdir)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   262
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   263
    int result = PHYSFS_mkdir (STR2CSTR(newdir));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   265
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   268
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
 * PhysicsFS::delete name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
 * delete file with name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
VALUE physfs_delete (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   276
    int result = PHYSFS_delete (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   277
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   278
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   280
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   281
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   282
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   283
 * PhysicsFS::real_dir name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   284
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   285
 * return real directory (in search path) of a name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   286
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   287
VALUE physfs_real_dir (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   288
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   289
    const char *path = PHYSFS_getRealDir (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   290
    if (path == 0)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   291
        return Qnil;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   292
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   293
    return rb_str_new2 (path);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   294
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   295
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   296
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   297
 * PhysicsFS::enumerate dir
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   298
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   299
 * list a dir from a search path
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   300
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   301
VALUE physfs_enumerate (VALUE self, VALUE dir)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   302
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   303
    char **files = PHYSFS_enumerateFiles (STR2CSTR(dir));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   304
    char **i;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   305
    VALUE ary = rb_ary_new ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   306
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   307
    for (i = files; *i != 0; i++)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   308
        rb_ary_push (ary, rb_str_new2 (*i));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   309
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   310
    PHYSFS_freeList (files);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   311
    return ary;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   312
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   313
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   314
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   315
 * PhysicsFS::exists? name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   316
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   317
 * does a file with name exist?
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   318
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   319
VALUE physfs_exists (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   320
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   321
    int result = PHYSFS_exists (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   322
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   323
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   324
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   325
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   326
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   327
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   328
 * PhysicsFS::is_directory? name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   329
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   330
 * return true if name is directory
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   331
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   332
VALUE physfs_is_directory (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   333
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   334
    int result = PHYSFS_isDirectory (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   335
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   336
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   337
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   338
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   339
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   340
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   341
 * PhysicsFS::is_symlink? name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   342
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   343
 * return true if name is symlink
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   344
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   345
VALUE physfs_is_symlink (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   346
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   347
    int result = PHYSFS_isSymbolicLink (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   348
    if (result)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   349
        return Qtrue;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   350
    return Qfalse;
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   351
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   352
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   353
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   354
 * PhysicsFS::last_mod_time name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   355
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   356
 * return last modification time of a file
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   357
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   358
VALUE physfs_last_mod_time (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   359
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   360
    int result = PHYSFS_getLastModTime (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   361
    
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   362
    return INT2FIX(result);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   363
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   364
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   365
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   366
 * PhysicsFS::open_read name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   367
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   368
 * return +PhysicsFS::File+ ready for reading
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   369
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   370
VALUE physfs_open_read (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   371
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   372
    PHYSFS_file *file = PHYSFS_openRead (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   373
    return physfs_file_new (file);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   374
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   375
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   376
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   377
 * PhysicsFS::open_write name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   378
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   379
 * return PhysicsFS::File ready for writing
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   380
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   381
VALUE physfs_open_write (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   382
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   383
    PHYSFS_file *file = PHYSFS_openWrite (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   384
    return physfs_file_new (file);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   385
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   386
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   387
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   388
 * PhysicsFS::open_append name
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   389
 *
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   390
 * return PhysicsFS::File ready for appending
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   391
 */
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   392
VALUE physfs_open_append (VALUE self, VALUE name)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   393
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   394
    PHYSFS_file *file = PHYSFS_openAppend (STR2CSTR(name));
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   395
    return physfs_file_new (file);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   396
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   397
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   398
void Init_physfs_so (void)
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   399
{
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   400
    modulePhysfs = rb_define_module ("PhysicsFS");
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   401
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   402
    rb_define_singleton_method (modulePhysfs, "init_internal", physfs_init, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   403
    rb_define_singleton_method (modulePhysfs, "deinit", physfs_deinit, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   404
    rb_define_singleton_method (modulePhysfs, "version", physfs_version, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   405
    rb_define_singleton_method (modulePhysfs, "supported_archives",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   406
				physfs_supported_archives, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   407
    rb_define_singleton_method (modulePhysfs, "last_error", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   408
				physfs_last_error, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   409
    rb_define_singleton_method (modulePhysfs, "dir_separator",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   410
				physfs_dir_separator, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   411
    rb_define_singleton_method (modulePhysfs, "permit_symlinks",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   412
                                physfs_permit_symlinks, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   413
    rb_define_singleton_method (modulePhysfs, "cdrom_dirs", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   414
                                physfs_cdrom_dirs, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   415
    rb_define_singleton_method (modulePhysfs, "base_dir", physfs_base_dir, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   416
    rb_define_singleton_method (modulePhysfs, "user_dir", physfs_user_dir, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   417
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   418
    rb_define_singleton_method (modulePhysfs, "write_dir", physfs_write_dir, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   419
    rb_define_singleton_method (modulePhysfs, "write_dir=", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   420
                                physfs_set_write_dir, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   421
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   422
    rb_define_singleton_method (modulePhysfs, "add_to_search_path",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   423
                                physfs_add_search_path, 2);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   424
    rb_define_singleton_method (modulePhysfs, "remove_from_search_path",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   425
                                physfs_remove_search_path, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   426
    rb_define_singleton_method (modulePhysfs, "search_path",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   427
                                physfs_search_path, 0);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   428
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   429
    rb_define_singleton_method (modulePhysfs, "set_sane_config",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   430
                                physfs_setSaneConfig, 5);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   431
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   432
    rb_define_singleton_method (modulePhysfs, "mkdir", physfs_mkdir, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   433
    rb_define_singleton_method (modulePhysfs, "delete", physfs_delete, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   434
    rb_define_singleton_method (modulePhysfs, "real_dir",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   435
                                physfs_real_dir, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   436
    rb_define_singleton_method (modulePhysfs, "enumerate", physfs_enumerate, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   437
    rb_define_singleton_method (modulePhysfs, "exists?", physfs_exists, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   438
    rb_define_singleton_method (modulePhysfs, "is_directory?", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   439
                                physfs_is_directory, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   440
    rb_define_singleton_method (modulePhysfs, "is_symlink?", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   441
                                physfs_is_symlink, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   442
    rb_define_singleton_method (modulePhysfs, "last_mod_time",
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   443
                                physfs_last_mod_time, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   444
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   445
    rb_define_singleton_method (modulePhysfs, "open_read", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   446
                                physfs_open_read, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   447
    rb_define_singleton_method (modulePhysfs, "open_write", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   448
                                physfs_open_write, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   449
    rb_define_singleton_method (modulePhysfs, "open_append", 
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   450
                                physfs_open_append, 1);
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   451
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   452
    init_physfs_file ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   453
    init_sdl_rwops ();
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   454
}
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   455
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   456
/*
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   457
// Local Variables:
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   458
// mode: C
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   459
// c-indentation-style: "stroustrup"
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   460
// indent-tabs-mode: nil
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   461
// End:
f4e89d934fee Initial import of Ruby bindings for PhysicsFS.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   462
*/