This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
class Hash::Weak < Hash | |
def []( key ) | |
# get the stored ID - a FixNum, not an object reference to our weak-referenced object | |
obj_id = super( key.to_sym ) | |
# theoretically this should cause non-referenced objects to get cleaned up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VALUE rb_index = Qnil; | |
VALUE rb_key = Qnil; | |
VALUE rb_hash_descriptor_index_key = Qnil; | |
VALUE rb_hash_descriptor_index_keys_array = Qnil; | |
VALUE rb_args_array = Qnil; | |
RARG_Define( | |
/*----------------------------------------------*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class << fiber_instance | |
extend Enumerable | |
attr_accessor :internal_enumerator | |
def each( & block ) | |
raise RuntimeError, "no internal enumerator specified" | |
return internal_enumerator.next | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.6) | |
project( rb_rpdb C ) | |
# add local modules path for project | |
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/" ) | |
# where to look for source files (headers and source) | |
include_directories( rpdb/include ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include( RecursivelyIncludeSource ) | |
set( _RUBY_DEBUG_OUTPUT ON) | |
# make sure we have libdb | |
find_package( RPDB REQUIRED ) | |
find_package( Ruby REQUIRED ) | |
message( STATUS "Using RPDB Lib: ${RPDB_LIBRARY}" ) | |
message( STATUS "Using Ruby Lib: ${RUBY_LIBRARY}" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function processes each sub-directory and then adds each source file in directory | |
# each function should cascade back upward in setting variables so that the bottom directory | |
# adds its source first, and then the level above it adds its source and passes both up, and so on... | |
function( recursively_include_src which_directory return_variable ) | |
if( ${return_variable} STREQUAL "headers" ) | |
set( file_extension ".h" ) | |
else( ${return_variable} STREQUAL "headers" ) | |
set( file_extension ".c" ) | |
endif( ${return_variable} STREQUAL "headers" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************** | |
* retrieve_data_for_key * | |
* retrieve_for_key * | |
* retrieve * | |
**************************/ | |
// database.retrieve( primary_key ) | |
// database.retrieve( :index, secondary_key ) | |
// database.retrieve( :index => secondary_key_in_index ) | |
// database.retrieve( :index => [ secondary_keys_in_index, ... ] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def method | |
puts 'do some stuff' | |
end | |
def method_with_same_name_as_in_module | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* (c) 2010 John Mair (banisterfiend), Asher (Asher), MIT license */ | |
#include "compat.h" | |
#include "ruby.h" | |
VALUE | |
rb_prepend_methods(VALUE klass) | |
{ | |
VALUE m = rb_module_new(); | |
st_free_table(RCLASS_M_TBL(m)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void input() { | |
float input_temperature_f; | |
printf( "Input temperature in Fahrenheit.\n" ); | |
scanf( "%f", &input_temperature_f ); | |
} |
OlderNewer