Data Structures | Defines | Functions | Variables

ext/sdbm/init.c File Reference

#include "ruby.h"
#include "sdbm.h"
#include <fcntl.h>
#include <errno.h>
Include dependency graph for init.c:

Go to the source code of this file.

Data Structures

struct  dbmdata

Defines

#define GetDBM(obj, dbmp)
#define GetDBM2(obj, data, dbm)

Functions

static void closed_sdbm ()
static void free_sdbm (struct dbmdata *dbmp)
static VALUE fsdbm_close (VALUE obj)
static VALUE fsdbm_closed (VALUE obj)
static VALUE fsdbm_alloc (VALUE klass)
static VALUE fsdbm_initialize (int argc, VALUE *argv, VALUE obj)
static VALUE fsdbm_s_open (int argc, VALUE *argv, VALUE klass)
static VALUE fsdbm_fetch (VALUE obj, VALUE keystr, VALUE ifnone)
static VALUE fsdbm_aref (VALUE obj, VALUE keystr)
static VALUE fsdbm_fetch_m (int argc, VALUE *argv, VALUE obj)
static VALUE fsdbm_key (VALUE obj, VALUE valstr)
static VALUE fsdbm_index (VALUE hash, VALUE value)
static VALUE fsdbm_select (VALUE obj)
static VALUE fsdbm_values_at (int argc, VALUE *argv, VALUE obj)
static void fdbm_modify (VALUE obj)
static VALUE fsdbm_delete (VALUE obj, VALUE keystr)
static VALUE fsdbm_shift (VALUE obj)
static VALUE fsdbm_delete_if (VALUE obj)
static VALUE fsdbm_clear (VALUE obj)
static VALUE fsdbm_invert (VALUE obj)
static VALUE fsdbm_store (VALUE obj, VALUE keystr, VALUE valstr)
static VALUE update_i (VALUE pair, VALUE dbm)
static VALUE fsdbm_update (VALUE obj, VALUE other)
static VALUE fsdbm_replace (VALUE obj, VALUE other)
static VALUE fsdbm_length (VALUE obj)
static VALUE fsdbm_empty_p (VALUE obj)
static VALUE fsdbm_each_value (VALUE obj)
static VALUE fsdbm_each_key (VALUE obj)
static VALUE fsdbm_each_pair (VALUE obj)
static VALUE fsdbm_keys (VALUE obj)
static VALUE fsdbm_values (VALUE obj)
static VALUE fsdbm_has_key (VALUE obj, VALUE keystr)
static VALUE fsdbm_has_value (VALUE obj, VALUE valstr)
static VALUE fsdbm_to_a (VALUE obj)
static VALUE fsdbm_to_hash (VALUE obj)
static VALUE fsdbm_reject (VALUE obj)
void Init_sdbm ()

Variables

static VALUE rb_cDBM
static VALUE rb_eDBMError

Define Documentation

#define GetDBM (   obj,
  dbmp 
)
Value:
{\
    Data_Get_Struct(obj, struct dbmdata, dbmp);\
    if (dbmp == 0) closed_sdbm();\
    if (dbmp->di_dbm == 0) closed_sdbm();\
}

Definition at line 31 of file init.c.

Referenced by fsdbm_close(), and fsdbm_empty_p().

#define GetDBM2 (   obj,
  data,
  dbm 
)

Function Documentation

static void closed_sdbm (  )  [static]

Definition at line 26 of file init.c.

References rb_eDBMError, and rb_raise().

static void fdbm_modify ( VALUE  obj  )  [static]

Definition at line 245 of file init.c.

References OBJ_FROZEN, rb_error_frozen(), and rb_secure().

Referenced by fsdbm_clear(), fsdbm_delete(), fsdbm_delete_if(), fsdbm_shift(), and fsdbm_store().

static void free_sdbm ( struct dbmdata dbmp  )  [static]

Definition at line 43 of file init.c.

References dbmdata::di_dbm, ruby_xfree(), and sdbm_close().

Referenced by fsdbm_alloc(), and fsdbm_s_open().

static VALUE fsdbm_alloc ( VALUE  klass  )  [static]

Definition at line 77 of file init.c.

References Data_Wrap_Struct, and free_sdbm().

Referenced by Init_sdbm().

static VALUE fsdbm_aref ( VALUE  obj,
VALUE  keystr 
) [static]

Definition at line 161 of file init.c.

References fsdbm_fetch(), and Qnil.

Referenced by Init_sdbm().

static VALUE fsdbm_clear ( VALUE  obj  )  [static]
static VALUE fsdbm_close ( VALUE  obj  )  [static]

Definition at line 51 of file init.c.

References dbmdata::di_dbm, GetDBM, and sdbm_close().

Referenced by fsdbm_s_open(), and Init_sdbm().

static VALUE fsdbm_closed ( VALUE  obj  )  [static]

Definition at line 63 of file init.c.

References Data_Get_Struct, and dbmdata::di_dbm.

Referenced by Init_sdbm().

static VALUE fsdbm_delete ( VALUE  obj,
VALUE  keystr 
) [static]
static VALUE fsdbm_delete_if ( VALUE  obj  )  [static]
static VALUE fsdbm_each_key ( VALUE  obj  )  [static]
static VALUE fsdbm_each_pair ( VALUE  obj  )  [static]
static VALUE fsdbm_each_value ( VALUE  obj  )  [static]
static VALUE fsdbm_empty_p ( VALUE  obj  )  [static]

Definition at line 468 of file init.c.

References dbmdata::di_dbm, dbmdata::di_size, datum::dptr, GetDBM, sdbm_firstkey(), and sdbm_nextkey().

Referenced by Init_sdbm().

static VALUE fsdbm_fetch ( VALUE  obj,
VALUE  keystr,
VALUE  ifnone 
) [static]
static VALUE fsdbm_fetch_m ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 167 of file init.c.

References fsdbm_fetch(), NIL_P, rb_block_given_p(), rb_eIndexError, rb_raise(), and rb_scan_args().

Referenced by Init_sdbm().

static VALUE fsdbm_has_key ( VALUE  obj,
VALUE  keystr 
) [static]

Definition at line 583 of file init.c.

References datum::dptr, datum::dsize, ExportStringValue, GetDBM2, RSTRING_LEN, RSTRING_PTR, and sdbm_fetch().

Referenced by Init_sdbm().

static VALUE fsdbm_has_value ( VALUE  obj,
VALUE  valstr 
) [static]
static VALUE fsdbm_index ( VALUE  hash,
VALUE  value 
) [static]

Definition at line 201 of file init.c.

References fsdbm_key(), and rb_warn().

Referenced by Init_sdbm().

static VALUE fsdbm_initialize ( int  argc,
VALUE argv,
VALUE  obj 
) [static]
static VALUE fsdbm_invert ( VALUE  obj  )  [static]
static VALUE fsdbm_key ( VALUE  obj,
VALUE  valstr 
) [static]
static VALUE fsdbm_keys ( VALUE  obj  )  [static]
static VALUE fsdbm_length ( VALUE  obj  )  [static]

Definition at line 449 of file init.c.

References dbmdata::di_size, datum::dptr, GetDBM2, INT2FIX, sdbm_firstkey(), and sdbm_nextkey().

Referenced by Init_sdbm().

static VALUE fsdbm_reject ( VALUE  obj  )  [static]

Definition at line 659 of file init.c.

References fsdbm_to_hash(), and rb_hash_delete_if().

Referenced by Init_sdbm().

static VALUE fsdbm_replace ( VALUE  obj,
VALUE  other 
) [static]

Definition at line 441 of file init.c.

References fsdbm_clear(), rb_block_call, rb_intern, and update_i().

Referenced by Init_sdbm().

static VALUE fsdbm_s_open ( int  argc,
VALUE argv,
VALUE  klass 
) [static]
static VALUE fsdbm_select ( VALUE  obj  )  [static]
static VALUE fsdbm_shift ( VALUE  obj  )  [static]
static VALUE fsdbm_store ( VALUE  obj,
VALUE  keystr,
VALUE  valstr 
) [static]
static VALUE fsdbm_to_a ( VALUE  obj  )  [static]
static VALUE fsdbm_to_hash ( VALUE  obj  )  [static]
static VALUE fsdbm_update ( VALUE  obj,
VALUE  other 
) [static]

Definition at line 434 of file init.c.

References rb_block_call, rb_intern, and update_i().

Referenced by Init_sdbm().

static VALUE fsdbm_values ( VALUE  obj  )  [static]
static VALUE fsdbm_values_at ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 232 of file init.c.

References fsdbm_fetch(), Qnil, rb_ary_new2(), and rb_ary_push().

Referenced by Init_sdbm().

void Init_sdbm (  ) 
static VALUE update_i ( VALUE  pair,
VALUE  dbm 
) [static]

Definition at line 423 of file init.c.

References Check_Type, fsdbm_store(), RARRAY_LEN, RARRAY_PTR, rb_eArgError, rb_raise(), and T_ARRAY.

Referenced by fsdbm_replace(), and fsdbm_update().


Variable Documentation

VALUE rb_cDBM [static]

Definition at line 18 of file init.c.

Referenced by Init_sdbm().

VALUE rb_eDBMError [static]

Definition at line 18 of file init.c.

Referenced by closed_sdbm(), fsdbm_clear(), fsdbm_delete(), fsdbm_delete_if(), fsdbm_store(), and Init_sdbm().