mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
edf2e9b7c7
commit
9c5b1986a3
11 changed files with 8382 additions and 0 deletions
1
ext/Win32API/depend
Normal file
1
ext/Win32API/depend
Normal file
|
@ -0,0 +1 @@
|
|||
Win32API.o : Win32API.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
|
3
ext/mandel/MANIFEST
Normal file
3
ext/mandel/MANIFEST
Normal file
|
@ -0,0 +1,3 @@
|
|||
MANIFEST
|
||||
mandel.c
|
||||
tkmandel.rb
|
59
ext/mandel/mandel.c
Normal file
59
ext/mandel/mandel.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/************************************************
|
||||
|
||||
mandel.c -
|
||||
|
||||
$Author$
|
||||
|
||||
************************************************/
|
||||
|
||||
#include "ruby.h"
|
||||
#include "math.h"
|
||||
|
||||
static VALUE
|
||||
mandel(self, re, im, max)
|
||||
VALUE self;
|
||||
VALUE re;
|
||||
VALUE im;
|
||||
VALUE max;
|
||||
{
|
||||
double real, image;
|
||||
double z_real, z_image;
|
||||
double tmp_real;
|
||||
int maximum;
|
||||
int i;
|
||||
|
||||
Check_Type(re, T_FLOAT);
|
||||
Check_Type(im, T_FLOAT);
|
||||
Check_Type(max, T_FIXNUM);
|
||||
|
||||
real = RFLOAT(re)->value;
|
||||
image = RFLOAT(im)->value;
|
||||
maximum = FIX2INT(max);
|
||||
|
||||
/***
|
||||
z = c = Complex(re, im)
|
||||
for i in 0 .. $max_deapth
|
||||
z = (z * z) + c
|
||||
break if z.abs > 2
|
||||
end
|
||||
return i
|
||||
***/
|
||||
|
||||
z_real = real;
|
||||
z_image = image;
|
||||
for (i = 0; i < maximum; i++) {
|
||||
tmp_real = ((z_real * z_real) - (z_image * z_image)) + real;
|
||||
z_image = ((z_real * z_image) + (z_image * z_real)) + image;
|
||||
z_real = tmp_real;
|
||||
if ( ((z_real * z_real) + (z_image * z_image)) > 4.0 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return INT2FIX(i);
|
||||
}
|
||||
|
||||
Init_mandel()
|
||||
{
|
||||
VALUE mMandel = rb_define_module("Mandel");
|
||||
rb_define_module_function(mMandel, "mandel", mandel, 3);
|
||||
}
|
172
ext/mandel/tkmandel.rb
Normal file
172
ext/mandel/tkmandel.rb
Normal file
|
@ -0,0 +1,172 @@
|
|||
# require "complex"
|
||||
require "mandel"
|
||||
require "tkclass"
|
||||
|
||||
DefaultMaxDepth = 30
|
||||
DefaultSX = -2.25
|
||||
DefaultSY = 1.75
|
||||
DefaultEX = 1.25
|
||||
DefaultEY = -1.75
|
||||
|
||||
def reset
|
||||
$max_depth = DefaultMaxDepth
|
||||
$s_re = DefaultSX
|
||||
$s_im = DefaultSY
|
||||
$e_re = DefaultEX
|
||||
$e_im = DefaultEY
|
||||
$dx = ($e_re - $s_re).abs / Width
|
||||
$dy = ($e_im - $s_im).abs / Height
|
||||
$photo.blank
|
||||
end
|
||||
|
||||
|
||||
Width = 400
|
||||
Height = 400
|
||||
|
||||
$c = Canvas.new {
|
||||
width Width
|
||||
height Height
|
||||
}
|
||||
$c.pack
|
||||
|
||||
$c_rect = Rectangle.new($c, 0, 0, Width+1, Height+1)
|
||||
$c_rect.fill "white"
|
||||
|
||||
$colors = []
|
||||
|
||||
def colors_init
|
||||
$colors = []
|
||||
for i in 0 .. 125
|
||||
$colors.push(format("#%02x%02x%02x", 250 - (i*2), i*2, 0))
|
||||
end
|
||||
for i in 0 .. 125
|
||||
$colors.push(format("#%02x%02x%02x", 0, 250 - (i*2), i*2))
|
||||
end
|
||||
$color_max = $colors.size - 1
|
||||
end
|
||||
|
||||
def zoom(a, b, c, d)
|
||||
center_x = (a + c) / 2
|
||||
center_y = (b + d) / 2
|
||||
size = (c - a).abs
|
||||
size = (d - b).abs if (size < (d - b).abs)
|
||||
size = 1 if (size < 1)
|
||||
zoom_rate = ((Width + Height) / 2).to_f / size
|
||||
$max_depth = ($max_depth.to_f * Math.sqrt(Math.sqrt(Math.sqrt(zoom_rate)))).to_i
|
||||
|
||||
move_x_rate = (center_x - (Width / 2)).to_f / (Width / 2)
|
||||
move_y_rate = (center_y - (Height / 2)).to_f / (Height / 2)
|
||||
|
||||
center_re = ($s_re + $e_re) / 2
|
||||
center_im = ($s_im + $e_im) / 2
|
||||
c_size_re = ($e_re - $s_re).abs
|
||||
c_size_im = ($e_im - $s_im).abs
|
||||
|
||||
center_re = center_re + (move_x_rate * (c_size_re / 2))
|
||||
center_im = center_im - (move_y_rate * (c_size_im / 2))
|
||||
|
||||
$s_re = center_re - ((c_size_re / 2) / zoom_rate)
|
||||
$s_im = center_im + ((c_size_im / 2) / zoom_rate)
|
||||
$e_re = center_re + ((c_size_re / 2) / zoom_rate)
|
||||
$e_im = center_im - ((c_size_im / 2) / zoom_rate)
|
||||
|
||||
$dx = ($e_re - $s_re).abs / Width
|
||||
$dy = ($e_im - $s_im).abs / Height
|
||||
p [$s_re, $dx, $s_im, $dy]
|
||||
end
|
||||
|
||||
|
||||
def mandel(x, y)
|
||||
re = $s_re + ($dx * x)
|
||||
im = $s_im - ($dy * y)
|
||||
# z = c = Complex(re, im)
|
||||
# for i in 0 .. $max_depth
|
||||
# z = (z * z) + c
|
||||
# break if z.abs > 2
|
||||
# end
|
||||
# return i
|
||||
return Mandel.mandel(re, im, $max_depth)
|
||||
end
|
||||
|
||||
$buf = "{"+" "*Width+"}"
|
||||
def calc
|
||||
$c.update
|
||||
return if $current_rect
|
||||
depth = 0
|
||||
|
||||
for x in 0 .. Width - 1
|
||||
depth = mandel(x, $calc_y)
|
||||
if depth >= $max_depth
|
||||
$buf[x*8+1,7] = "#000000"
|
||||
else
|
||||
$buf[x*8+1,7] = $colors[$color_max * depth / $max_depth]
|
||||
end
|
||||
end
|
||||
$photo.put($buf, 0, $calc_y)
|
||||
|
||||
$calc_y += 1
|
||||
if (($calc_y % 20) == 0)
|
||||
print "#{($calc_y * 100 / Height)}% done. -- depth #{$max_depth}\n"
|
||||
# $mandel.image $photo
|
||||
end
|
||||
|
||||
if ($calc_y > Height - 1)
|
||||
$calc_y = StartCalcY
|
||||
$calc_on = false
|
||||
# exit
|
||||
end
|
||||
|
||||
if $calc_on
|
||||
Tk.after(1) { calc() }
|
||||
end
|
||||
end
|
||||
|
||||
$photo = TkPhotoImage.new({'width'=>Width, 'height'=>Height})
|
||||
$mandel = TkcImage.new($c, Width/2, Height/2) { image $photo }
|
||||
reset()
|
||||
colors_init()
|
||||
$calc_y = StartCalcY = 0
|
||||
$calc_on = true
|
||||
calc()
|
||||
|
||||
def clear
|
||||
# $mandel.destroy if $mandel
|
||||
$calc_y = StartCalcY
|
||||
end
|
||||
|
||||
$start_x = $start_y = 0
|
||||
$current_rect = nil
|
||||
|
||||
def do_press(x, y)
|
||||
$start_x = x
|
||||
$start_y = y
|
||||
$current_rect = Rectangle.new($c, x, y, x, y) { outline "white" }
|
||||
end
|
||||
|
||||
def do_motion(x, y)
|
||||
if $current_rect
|
||||
$current_rect.coords $start_x, $start_y, x, y
|
||||
end
|
||||
end
|
||||
|
||||
def do_release(x, y)
|
||||
if $current_rect
|
||||
$current_rect.coords $start_x, $start_y, x, y
|
||||
$current_rect.destroy
|
||||
$current_rect = nil
|
||||
clear()
|
||||
$calc_on = true
|
||||
zoom($start_x, $start_y, x, y)
|
||||
calc()
|
||||
end
|
||||
end
|
||||
|
||||
$c.bind("1", proc{|e| do_press e.x, e.y})
|
||||
$c.bind("B1-Motion", proc{|x, y| do_motion x, y}, "%x %y")
|
||||
$c.bind("ButtonRelease-1", proc{|x, y| do_release x, y}, "%x %y")
|
||||
|
||||
begin
|
||||
Tk.mainloop
|
||||
ensure
|
||||
# File.delete("#tmpmandel#.gif")
|
||||
end
|
4
ext/readline/MANIFEST
Normal file
4
ext/readline/MANIFEST
Normal file
|
@ -0,0 +1,4 @@
|
|||
MANIFEST
|
||||
README
|
||||
extconf.rb
|
||||
readline.c
|
55
ext/readline/README
Normal file
55
ext/readline/README
Normal file
|
@ -0,0 +1,55 @@
|
|||
GNU Readline Libraryを利用するための拡張モジュールです。
|
||||
|
||||
require "readline"
|
||||
include Readline
|
||||
|
||||
line = readline("Prompt> ", TRUE)
|
||||
|
||||
のように使用してください。
|
||||
|
||||
[Readline]
|
||||
|
||||
<モジュール関数>
|
||||
|
||||
readline(prompt, add=nil)
|
||||
|
||||
一行入力を読み込みます。
|
||||
addがTRUEの場合、ヒストリに読み込んだ文字列を追加します。
|
||||
|
||||
<クラスメソッド>
|
||||
|
||||
completion_proc = proc
|
||||
|
||||
補完時の動作を決定するProcオブジェクトを指定します。
|
||||
procは引数に入力文字列を取り、候補文字列の配列を返すように
|
||||
してください。
|
||||
|
||||
completion_proc
|
||||
|
||||
補完時の動作を決定するProcオブジェクトを返します。
|
||||
|
||||
completion_case_fold = case_fold
|
||||
|
||||
補完時に大文字小文字を区別しない場合、TRUEを指定します。
|
||||
|
||||
completion_case_fold
|
||||
|
||||
補完時に大文字小文字を区別しない場合、TRUEを返します。
|
||||
|
||||
vi_editing_mode
|
||||
|
||||
VIモードになります。
|
||||
|
||||
emacs_editing_mode
|
||||
|
||||
Emacsモードになります。
|
||||
|
||||
<クラス定数>
|
||||
|
||||
HISTORY
|
||||
|
||||
ヒストリに対する操作はこの定数を通して行ってください。
|
||||
配列と同じように扱えるようになっています。
|
||||
|
||||
|
||||
|
8
ext/readline/extconf.rb
Normal file
8
ext/readline/extconf.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require "mkmf"
|
||||
|
||||
have_library("termcap", "tgetnum")
|
||||
if have_header("readline/readline.h") and
|
||||
have_header("readline/history.h") and
|
||||
have_library("readline", "readline")
|
||||
create_makefile("readline")
|
||||
end
|
386
ext/readline/readline.c
Normal file
386
ext/readline/readline.c
Normal file
|
@ -0,0 +1,386 @@
|
|||
/* readline.c -- GNU Readline module
|
||||
Copyright (C) 1997-1998 Shugo Maeda */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
#include "ruby.h"
|
||||
#include "rubysig.h"
|
||||
|
||||
static VALUE mReadline;
|
||||
|
||||
#define TOLOWER(c) (isupper(c) ? tolower(c) : c)
|
||||
|
||||
#define COMPLETION_PROC "completion_proc"
|
||||
#define COMPLETION_CASE_FOLD "completion_case_fold"
|
||||
|
||||
static int
|
||||
readline_event()
|
||||
{
|
||||
CHECK_INTS;
|
||||
#ifdef USE_THREAD
|
||||
rb_thread_schedule();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_readline(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE tmp, add_hist, result;
|
||||
char *prompt = NULL;
|
||||
char *buff;
|
||||
|
||||
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
|
||||
prompt = STR2CSTR(tmp);
|
||||
}
|
||||
buff = readline(prompt);
|
||||
if (RTEST(add_hist) && buff) {
|
||||
add_history(buff);
|
||||
}
|
||||
if (buff)
|
||||
result = rb_str_new2(buff);
|
||||
else
|
||||
result = Qnil;
|
||||
if (buff) free(buff);
|
||||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_set_completion_proc(VALUE self, VALUE proc)
|
||||
{
|
||||
if (!rb_respond_to(proc, rb_intern("call")))
|
||||
rb_raise(rb_eArgError, "argument have to respond to `call'");
|
||||
return rb_iv_set(mReadline, COMPLETION_PROC, proc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_get_completion_proc(VALUE self)
|
||||
{
|
||||
return rb_iv_get(mReadline, COMPLETION_PROC);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_set_completion_case_fold(VALUE self, VALUE val)
|
||||
{
|
||||
return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_get_completion_case_fold(VALUE self)
|
||||
{
|
||||
return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
|
||||
}
|
||||
|
||||
static char **
|
||||
readline_attempted_completion_function(char *text, int start, int end)
|
||||
{
|
||||
VALUE proc, ary, temp;
|
||||
char **result;
|
||||
int case_fold;
|
||||
int i, matches;
|
||||
|
||||
proc = rb_iv_get(mReadline, COMPLETION_PROC);
|
||||
rl_attempted_completion_over = 1;
|
||||
case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
|
||||
ary = rb_funcall(proc, rb_intern("call"), 1, rb_str_new2(text));
|
||||
if (TYPE(ary) != T_ARRAY)
|
||||
ary = rb_Array(ary);
|
||||
matches = RARRAY(ary)->len;
|
||||
if (matches == 0)
|
||||
return NULL;
|
||||
result = ALLOC_N(char *, matches + 2);
|
||||
for (i = 0; i < matches; i++) {
|
||||
temp = rb_obj_as_string(RARRAY(ary)->ptr[i]);
|
||||
result[i + 1] = ALLOC_N(char, RSTRING(temp)->len + 1);
|
||||
strcpy(result[i + 1], RSTRING(temp)->ptr);
|
||||
}
|
||||
result[matches + 1] = NULL;
|
||||
|
||||
if (matches == 1) {
|
||||
result[0] = result[1];
|
||||
result[1] = NULL;
|
||||
} else {
|
||||
register int i = 1;
|
||||
int low = 100000;
|
||||
|
||||
while (i < matches) {
|
||||
register int c1, c2, si;
|
||||
|
||||
if (case_fold) {
|
||||
for (si = 0;
|
||||
(c1 = TOLOWER(result[i][si])) &&
|
||||
(c2 = TOLOWER(result[i + 1][si]));
|
||||
si++)
|
||||
if (c1 != c2) break;
|
||||
} else {
|
||||
for (si = 0;
|
||||
(c1 = result[i][si]) &&
|
||||
(c2 = result[i + 1][si]);
|
||||
si++)
|
||||
if (c1 != c2) break;
|
||||
}
|
||||
|
||||
if (low > si) low = si;
|
||||
i++;
|
||||
}
|
||||
result[0] = ALLOC_N(char, low + 1);
|
||||
strncpy(result[0], result[1], low);
|
||||
result[0][low] = '\0';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_vi_editing_mode(VALUE self)
|
||||
{
|
||||
rl_vi_editing_mode();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
readline_s_emacs_editing_mode(VALUE self)
|
||||
{
|
||||
rl_emacs_editing_mode();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_to_s(VALUE self)
|
||||
{
|
||||
return rb_str_new2("HISTORY");
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_get(VALUE self, VALUE index)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
int i;
|
||||
|
||||
state = history_get_history_state();
|
||||
i = NUM2INT(index);
|
||||
if (i < 0 || i > state->length - 1) {
|
||||
rb_raise(rb_eIndexError, "Invalid index");
|
||||
}
|
||||
return rb_str_new2(state->entries[i]->line);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_set(VALUE self, VALUE index, VALUE str)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
int i;
|
||||
|
||||
state = history_get_history_state();
|
||||
i = NUM2INT(index);
|
||||
if (i < 0 || i > state->length - 1) {
|
||||
rb_raise(rb_eIndexError, "Invalid index");
|
||||
}
|
||||
replace_history_entry(i, STR2CSTR(str), NULL);
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_push(VALUE self, VALUE str)
|
||||
{
|
||||
add_history(STR2CSTR(str));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_push_method(int argc, VALUE *argv,
|
||||
VALUE self)
|
||||
{
|
||||
VALUE str;
|
||||
|
||||
while (argc--) {
|
||||
str = *argv++;
|
||||
add_history(STR2CSTR(str));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_pop(VALUE self)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
HIST_ENTRY *entry;
|
||||
|
||||
state = history_get_history_state();
|
||||
if (state->length > 0) {
|
||||
entry = remove_history(state->length - 1);
|
||||
return rb_str_new2(entry->line);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_shift(VALUE self)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
HIST_ENTRY *entry;
|
||||
|
||||
state = history_get_history_state();
|
||||
if (state->length > 0) {
|
||||
entry = remove_history(0);
|
||||
return rb_str_new2(entry->line);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_each(VALUE self)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
int i;
|
||||
|
||||
state = history_get_history_state();
|
||||
for (i = 0; i < state->length; i++) {
|
||||
rb_yield(rb_str_new2(state->entries[i]->line));
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_length(VALUE self)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
|
||||
state = history_get_history_state();
|
||||
return INT2NUM(state->length);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_empty_p(VALUE self)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
|
||||
state = history_get_history_state();
|
||||
if (state->length == 0)
|
||||
return Qtrue;
|
||||
else
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hist_delete_at(VALUE self, VALUE index)
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
HIST_ENTRY *entry;
|
||||
int i;
|
||||
|
||||
state = history_get_history_state();
|
||||
i = NUM2INT(index);
|
||||
if (i < 0 || i > state->length - 1) {
|
||||
rb_raise(rb_eIndexError, "Invalid index");
|
||||
}
|
||||
entry = remove_history(NUM2INT(index));
|
||||
return rb_str_new2(entry->line);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
filename_completion_proc_call(VALUE self, VALUE str)
|
||||
{
|
||||
VALUE result;
|
||||
char **matches;
|
||||
int i;
|
||||
|
||||
matches = completion_matches(STR2CSTR(str),
|
||||
filename_completion_function);
|
||||
if (matches) {
|
||||
result = rb_ary_new();
|
||||
for (i = 0; matches[i]; i++) {
|
||||
rb_ary_push(result, rb_str_new2(matches[i]));
|
||||
free(matches[i]);
|
||||
}
|
||||
free(matches);
|
||||
if (RARRAY(result)->len >= 2)
|
||||
rb_ary_shift(result);
|
||||
}
|
||||
else {
|
||||
result = Qnil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
username_completion_proc_call(VALUE self, VALUE str)
|
||||
{
|
||||
VALUE result;
|
||||
char **matches;
|
||||
int i;
|
||||
|
||||
matches = completion_matches(STR2CSTR(str),
|
||||
username_completion_function);
|
||||
if (matches) {
|
||||
result = rb_ary_new();
|
||||
for (i = 0; matches[i]; i++) {
|
||||
rb_ary_push(result, rb_str_new2(matches[i]));
|
||||
free(matches[i]);
|
||||
}
|
||||
free(matches);
|
||||
if (RARRAY(result)->len >= 2)
|
||||
rb_ary_shift(result);
|
||||
}
|
||||
else {
|
||||
result = Qnil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
Init_readline(void)
|
||||
{
|
||||
VALUE histary, fcomp, ucomp;
|
||||
|
||||
using_history();
|
||||
|
||||
mReadline = rb_define_module("Readline");
|
||||
rb_define_module_function(mReadline, "readline",
|
||||
readline_readline, -1);
|
||||
rb_define_singleton_method(mReadline, "completion_proc=",
|
||||
readline_s_set_completion_proc, 1);
|
||||
rb_define_singleton_method(mReadline, "completion_proc",
|
||||
readline_s_get_completion_proc, 0);
|
||||
rb_define_singleton_method(mReadline, "completion_case_fold=",
|
||||
readline_s_set_completion_case_fold, 1);
|
||||
rb_define_singleton_method(mReadline, "completion_case_fold",
|
||||
readline_s_get_completion_case_fold, 0);
|
||||
rb_define_singleton_method(mReadline, "vi_editing_mode",
|
||||
readline_s_vi_editing_mode, 0);
|
||||
rb_define_singleton_method(mReadline, "emacs_editing_mode",
|
||||
readline_s_emacs_editing_mode, 0);
|
||||
|
||||
histary = rb_obj_alloc(rb_cObject);
|
||||
rb_extend_object(histary, rb_mEnumerable);
|
||||
rb_define_singleton_method(histary,"to_s", hist_to_s, 0);
|
||||
rb_define_singleton_method(histary,"[]", hist_get, 1);
|
||||
rb_define_singleton_method(histary,"[]=", hist_set, 2);
|
||||
rb_define_singleton_method(histary,"<<", hist_push, 1);
|
||||
rb_define_singleton_method(histary,"push", hist_push_method, -1);
|
||||
rb_define_singleton_method(histary,"pop", hist_pop, 0);
|
||||
rb_define_singleton_method(histary,"shift", hist_shift, 0);
|
||||
rb_define_singleton_method(histary,"each", hist_each, 0);
|
||||
rb_define_singleton_method(histary,"length", hist_length, 0);
|
||||
rb_define_singleton_method(histary,"empty?", hist_empty_p, 0);
|
||||
rb_define_singleton_method(histary,"delete_at", hist_delete_at, 1);
|
||||
rb_define_const(mReadline, "HISTORY", histary);
|
||||
|
||||
fcomp = rb_obj_alloc(rb_cObject);
|
||||
rb_define_singleton_method(fcomp, "call",
|
||||
filename_completion_proc_call, 1);
|
||||
rb_define_const(mReadline, "FILENAME_COMPLETION_PROC", fcomp);
|
||||
|
||||
ucomp = rb_obj_alloc(rb_cObject);
|
||||
rb_define_singleton_method(ucomp, "call",
|
||||
username_completion_proc_call, 1);
|
||||
rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp);
|
||||
|
||||
rl_attempted_completion_function
|
||||
= (CPPFunction *) readline_attempted_completion_function;
|
||||
rl_event_hook = readline_event;
|
||||
rl_clear_signals();
|
||||
}
|
173
sample/mine.rb
Normal file
173
sample/mine.rb
Normal file
|
@ -0,0 +1,173 @@
|
|||
class Board
|
||||
def clr
|
||||
print "\e[2J"
|
||||
end
|
||||
def pos(x,y)
|
||||
printf "\e[%d;%dH", y+1, x*2+1
|
||||
end
|
||||
def colorstr(id,s)
|
||||
printf "\e[%dm%s\e[0m", id, s
|
||||
end
|
||||
def put(x, y, col, str)
|
||||
pos(x,y); colorstr(43,str)
|
||||
pos(0,@hi); print "$B;D$j(B:",@mc,"/",@total," "
|
||||
pos(x,y)
|
||||
end
|
||||
private :clr, :pos, :colorstr, :put
|
||||
CHR=["$B!&(B","$B#1(B","$B#2(B","$B#3(B","$B#4(B","$B#5(B","$B#6(B","$B#7(B","$B#8(B","$B!z(B","$B!|(B","@@"]
|
||||
COL=[46,43,45] # default,opened,over
|
||||
def initialize(h,w,m)
|
||||
# $B%2!<%`HW$N@8@.(B(h:$B=D!$(Bw:$B2#!$(Bm:$BGzCF$N?t(B)
|
||||
@hi=h; @wi=w; @m=m
|
||||
reset
|
||||
end
|
||||
def reset
|
||||
# $B%2!<%`HW$r(B($B:F(B)$B=i4|2=$9$k(B
|
||||
srand()
|
||||
@cx=0; @cy=0; @mc=@m
|
||||
@over=false
|
||||
@data=Array.new(@hi*@wi)
|
||||
@state=Array.new(@hi*@wi)
|
||||
@total=@hi*@wi
|
||||
@total.times {|i| @data[i]=0}
|
||||
@m.times do
|
||||
loop do
|
||||
j=rand(@total-1)
|
||||
if @data[j] == 0 then
|
||||
@data[j]=1
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
clr; pos(0,0)
|
||||
@hi.times{|y| pos(0,y); colorstr(COL[0],CHR[0]*@wi)}
|
||||
pos(@cx,@cy)
|
||||
end
|
||||
def mark
|
||||
# $B8=:_$N%+!<%=%k0LCV$K%^!<%/$r$D$1$k(B
|
||||
if @state[@wi*@cy+@cx] != nil then return end
|
||||
@state[@wi*@cy+@cx] = "MARK"
|
||||
@mc=@mc-1;
|
||||
@total=@total-1;
|
||||
put(@cx, @cy, COL[1], CHR[9])
|
||||
end
|
||||
def open(x=@cx,y=@cy)
|
||||
# $B8=:_$N%+!<%=%k0LCV$r%*!<%W%s$K$9$k(B
|
||||
# $BGzCF$,$"$l$P%2!<%`%*!<%P!<(B
|
||||
if @state[@wi*y+x] =="OPEN" then return 0 end
|
||||
if @state[@wi*y+x] == nil then @total=@total-1 end
|
||||
if @state[@wi*y+x] =="MARK" then @mc=@mc+1 end
|
||||
@state[@wi*y+x]="OPEN"
|
||||
if fetch(x,y) == 1 then @over = 1; return end
|
||||
c = count(x,y)
|
||||
put(x, y, COL[1], CHR[c])
|
||||
return 0 if c != 0
|
||||
if x > 0 && y > 0 then open(x-1,y-1) end
|
||||
if y > 0 then open(x, y-1) end
|
||||
if x < @wi-1 && y > 0 then open(x+1,y-1) end
|
||||
if x > 0 then open(x-1,y) end
|
||||
if x < @wi-1 then open(x+1,y) end
|
||||
if x > 0 && y < @hi-1 then open(x-1,y+1) end
|
||||
if y < @hi -1 then open(x,y+1) end
|
||||
if x < @wi-1 && y < @hi-1 then open(x+1,y+1) end
|
||||
pos(@cx,@cy)
|
||||
end
|
||||
def fetch(x,y)
|
||||
# (x,y)$B$N0LCV$NGzCF$N?t(B(0 or 1)$B$rJV$9(B
|
||||
if x < 0 then 0
|
||||
elsif x >= @wi then 0
|
||||
elsif y < 0 then 0
|
||||
elsif y >= @hi then 0
|
||||
else
|
||||
@data[x*@wi+y]
|
||||
end
|
||||
end
|
||||
def count(x,y)
|
||||
# (x,y)$B$KNY@\$9$kGzCF$N?t$rJV$9(B
|
||||
fetch(x-1,y-1)+fetch(x,y-1)+fetch(x+1,y-1)+
|
||||
fetch(x-1,y) + fetch(x+1,y)+
|
||||
fetch(x-1,y+1)+fetch(x,y+1)+fetch(x+1,y+1)
|
||||
end
|
||||
def over(win)
|
||||
# $B%2!<%`$N=*N;(B
|
||||
quit
|
||||
unless win
|
||||
pos(@cx,@cy); print CHR[11]
|
||||
end
|
||||
pos(0,@hi)
|
||||
if win then print "*** YOU WIN !! ***"
|
||||
else print "*** GAME OVER ***"
|
||||
end
|
||||
end
|
||||
def over?
|
||||
# $B%2!<%`$N=*N;%A%'%C%/(B
|
||||
# $B=*N;=hM}$b8F$S=P$9(B
|
||||
remain = (@mc+@total == 0)
|
||||
if @over || remain
|
||||
over(remain)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
def quit
|
||||
# $B%2!<%`$NCfCG(B($B$^$?$O=*N;(B)
|
||||
# $BHWLL$rA4$F8+$;$k(B
|
||||
@hi.times do|y|
|
||||
pos(0,y)
|
||||
@wi.times do|x|
|
||||
colorstr(if @state[y*@wi+x] == "MARK" then COL[1] else COL[2] end,
|
||||
if fetch(x,y)==1 then CHR[10] else CHR[count(x,y)] end)
|
||||
end
|
||||
end
|
||||
end
|
||||
def down
|
||||
# $B%+!<%=%k$r2<$K(B
|
||||
if @cy < @hi-1 then @cy=@cy+1; pos(@cx, @cy) end
|
||||
end
|
||||
def up
|
||||
# $B%+!<%=%k$r>e$K(B
|
||||
if @cy > 0 then @cy=@cy-1; pos(@cx, @cy) end
|
||||
end
|
||||
def left
|
||||
# $B%+!<%=%k$r:8$K(B
|
||||
if @cx > 0 then @cx=@cx-1; pos(@cx, @cy) end
|
||||
end
|
||||
def right
|
||||
# $B%+!<%=%k$r1&$K(B
|
||||
if @cx < @wi-1 then @cx=@cx+1; pos(@cx, @cy) end
|
||||
end
|
||||
end
|
||||
|
||||
bd=Board.new(10,10,10)
|
||||
system("stty raw -echo")
|
||||
begin
|
||||
loop do
|
||||
case getc
|
||||
when ?n # new game
|
||||
bd.reset
|
||||
when ?m # mark
|
||||
bd.mark
|
||||
when ?j
|
||||
bd.down
|
||||
when ?k
|
||||
bd.up
|
||||
when ?h
|
||||
bd.left
|
||||
when ?l
|
||||
bd.right
|
||||
when ?\s
|
||||
bd.open
|
||||
when ?q,?\C-c # quit game
|
||||
bd.quit
|
||||
break
|
||||
end
|
||||
if bd.over?
|
||||
if getc == ?q then break end
|
||||
bd.reset
|
||||
end
|
||||
end
|
||||
ensure
|
||||
system("stty -raw echo")
|
||||
end
|
||||
print "\n"
|
297
sample/rename.rb
Normal file
297
sample/rename.rb
Normal file
|
@ -0,0 +1,297 @@
|
|||
#! /usr/local/bin/ruby -p
|
||||
gsub!(/\bary_aref\b/,"rb_ary_aref")
|
||||
gsub!(/\bary_assoc\b/,"rb_ary_assoc")
|
||||
gsub!(/\bary_concat\b/,"rb_ary_concat")
|
||||
gsub!(/\bary_delete\b/,"rb_ary_delete")
|
||||
gsub!(/\bary_delete_at\b/,"rb_ary_delete_at")
|
||||
gsub!(/\bary_each\b/,"rb_ary_each")
|
||||
gsub!(/\bary_entry\b/,"rb_ary_entry")
|
||||
gsub!(/\bary_freeze\b/,"rb_ary_freeze")
|
||||
gsub!(/\bary_includes\b/,"rb_ary_includes")
|
||||
gsub!(/\bary_join\b/,"rb_ary_join")
|
||||
gsub!(/\bary_new([234])?\b/,"rb_ary_new\\1")
|
||||
gsub!(/\bary_plus\b/,"rb_ary_plus")
|
||||
gsub!(/\bary_pop\b/,"rb_ary_pop")
|
||||
gsub!(/\bary_push\b/,"rb_ary_push")
|
||||
gsub!(/\bary_rassoc\b/,"rb_ary_rassoc")
|
||||
gsub!(/\bary_reverse\b/,"rb_ary_reverse")
|
||||
gsub!(/\bary_shift\b/,"rb_ary_shift")
|
||||
gsub!(/\bary_sort\b/,"rb_ary_sort")
|
||||
gsub!(/\bary_store\b/,"rb_ary_store")
|
||||
gsub!(/\bary_to_s\b/,"rb_ary_to_s")
|
||||
gsub!(/\bary_unshift\b/,"rb_ary_unshift")
|
||||
gsub!(/\bassoc_new\b/,"rb_assoc_new")
|
||||
gsub!(/\bcArray\b/,"rb_cArray")
|
||||
gsub!(/\bmemclear\b/,"rb_mem_clear")
|
||||
gsub!(/\bbig2dbl\b/,"rb_big2dbl")
|
||||
gsub!(/\bbig2long\b/,"rb_big2long")
|
||||
gsub!(/\bbig2str\b/,"rb_big2str")
|
||||
gsub!(/\bbig2ulong\b/,"rb_big2ulong")
|
||||
gsub!(/\bbig_2comp\b/,"rb_big_2comp")
|
||||
gsub!(/\bbig_and\b/,"rb_big_and")
|
||||
gsub!(/\bbig_clone\b/,"rb_big_clone")
|
||||
gsub!(/\bbig_lshift\b/,"rb_big_lshift")
|
||||
gsub!(/\bbig_minus\b/,"rb_big_minus")
|
||||
gsub!(/\bbig_mul\b/,"rb_big_mul")
|
||||
gsub!(/\bbig_norm\b/,"rb_big_norm")
|
||||
gsub!(/\bbig_or\b/,"rb_big_or")
|
||||
gsub!(/\bbig_plus\b/,"rb_big_plus")
|
||||
gsub!(/\bbig_pow\b/,"rb_big_pow")
|
||||
gsub!(/\bbig_rand\b/,"rb_big_rand")
|
||||
gsub!(/\bbig_xor\b/,"rb_big_xor")
|
||||
gsub!(/\bcBignum\b/,"rb_cBignum")
|
||||
gsub!(/\bdbl2big\b/,"rb_dbl2big")
|
||||
gsub!(/\bint2big\b/,"rb_int2big")
|
||||
gsub!(/\bint2inum\b/,"rb_int2inum")
|
||||
gsub!(/\bstr2inum\b/,"rb_str2inum")
|
||||
gsub!(/\buint2big\b/,"rb_uint2big")
|
||||
gsub!(/\buint2inum\b/,"rb_uint2inum")
|
||||
gsub!(/\bclass_instance_methods\b/,"rb_class_instance_methods")
|
||||
gsub!(/\bclass_new\b/,"rb_class_new")
|
||||
gsub!(/\bclass_private_instance_methods\b/,"rb_class_private_instance_methods")
|
||||
gsub!(/\bclass_protected_instance_methods\b/,"rb_class_protected_instance_methods")
|
||||
gsub!(/\bmod_ancestors\b/,"rb_mod_ancestors")
|
||||
gsub!(/\bmod_included_modules\b/,"rb_mod_included_modules")
|
||||
gsub!(/\bmodule_new\b/,"rb_module_new")
|
||||
gsub!(/\bobj_singleton_methods\b/,"rb_obj_singleton_methods")
|
||||
gsub!(/\bsingleton_class\b/,"rb_singleton_class")
|
||||
gsub!(/\bmComparable\b/,"rb_mComparable")
|
||||
gsub!(/\bcDir\b/,"rb_cDir")
|
||||
gsub!(/\benum_length\b/,"rb_enum_length")
|
||||
gsub!(/\bmEnumerable\b/,"rb_mEnumerable")
|
||||
gsub!(/\bBug\b/,"rb_bug")
|
||||
gsub!(/\brb_check_type\b/,"rb_check_type")
|
||||
gsub!(/\beArgError\b/,"rb_eArgError")
|
||||
gsub!(/\beException\b/,"rb_eException")
|
||||
gsub!(/\beFatal\b/,"rb_eFatal")
|
||||
gsub!(/\beIndexError\b/,"rb_eIndexError")
|
||||
gsub!(/\beInterrupt\b/,"rb_eInterrupt")
|
||||
gsub!(/\beLoadError\b/,"rb_eLoadError")
|
||||
gsub!(/\beNameError\b/,"rb_eNameError")
|
||||
gsub!(/\beNotImpError\b/,"rb_eNotImpError")
|
||||
gsub!(/\beRuntimeError\b/,"rb_eRuntimeError")
|
||||
gsub!(/\beSecurityError\b/,"rb_eSecurityError")
|
||||
gsub!(/\beStandardError\b/,"rb_eStandardError")
|
||||
gsub!(/\beSyntaxError\b/,"rb_eSyntaxError")
|
||||
gsub!(/\beSystemCallError\b/,"rb_eSystemCallError")
|
||||
gsub!(/\beSystemExit\b/,"rb_eSystemExit")
|
||||
gsub!(/\beTypeError\b/,"rb_eTypeError")
|
||||
gsub!(/\bexc_new([23]?)\b/,"rb_exc_new\\1")
|
||||
gsub!(/\bFatal\b/,"rb_fatal")
|
||||
gsub!(/\bLoadError\b/,"rb_loaderror")
|
||||
gsub!(/\bmErrno\b/,"rb_mErrno")
|
||||
gsub!(/\bRaise\b/,"rb_raise")
|
||||
gsub!(/\bWarn(ing)?\b/,"rb_warn\\1")
|
||||
gsub!(/\bnerrs\b/,"ruby_nerrs")
|
||||
gsub!(/\bcProc\b/,"rb_cProc")
|
||||
gsub!(/\bcThread\b/,"rb_cThread")
|
||||
gsub!(/\brb_check_safe_str\b/,"rb_check_safe_str")
|
||||
gsub!(/\bclass_new_instance\b/,"rb_class_new_instance")
|
||||
gsub!(/\bdyna_var_asgn\b/,"rb_dvar_asgn")
|
||||
gsub!(/\bdyna_var_defined\b/,"rb_dvar_defined")
|
||||
gsub!(/\bdyna_var_push\b/,"rb_dvar_push")
|
||||
gsub!(/\bdyna_var_ref\b/,"rb_dvar_ref")
|
||||
gsub!(/\bf_lambda\b/,"rb_f_lambda")
|
||||
gsub!(/\bf_load\b/,";xxx_need_modify;rb_load")
|
||||
gsub!(/\bf_require\b/,"rb_f_require")
|
||||
gsub!(/\bgc_mark_threads\b/,"rb_gc_mark_threads")
|
||||
gsub!(/\biterator_p\b/,"rb_iterator_p")
|
||||
gsub!(/\bobj_call_init\b/,"rb_obj_call_init")
|
||||
gsub!(/\brb_set_end_proc\b/,"rb_set_end_proc")
|
||||
gsub!(/\brb_set_safe_level\b/,"rb_set_safe_level")
|
||||
gsub!(/\bthread_alone\b/,"rb_thread_alone")
|
||||
gsub!(/\bthread_create\b/,"rb_thread_create")
|
||||
gsub!(/\bthread_critical\b/,"rb_thread_critical")
|
||||
gsub!(/\bthread_fd_writable\b/,"rb_thread_fd_writable")
|
||||
gsub!(/\bthread_interrupt\b/,"rb_thread_interrupt")
|
||||
gsub!(/\bthread_schedule\b/,"rb_thread_schedule")
|
||||
gsub!(/\bthread_select\b/,"rb_thread_select")
|
||||
gsub!(/\bthread_sleep\b/,"rb_thread_sleep")
|
||||
gsub!(/\bthread_sleep_forever\b/,"rb_thread_sleep_forever")
|
||||
gsub!(/\bthread_trap_eval\b/,"rb_thread_trap_eval")
|
||||
gsub!(/\bthread_wait_fd\b/,"rb_thread_wait_fd")
|
||||
gsub!(/\bthread_wait_for\b/,"rb_thread_wait_for")
|
||||
gsub!(/\bthe_class\b/,"ruby_class")
|
||||
gsub!(/\bthe_dyna_vars\b/,"ruby_dyna_vars")
|
||||
gsub!(/\bthe_frame\b/,"ruby_frame")
|
||||
gsub!(/\bthe_init\b/,"ruby_init")
|
||||
gsub!(/\bthe_scope\b/,"ruby_scope")
|
||||
gsub!(/\bcFile\b/,"rb_cFile")
|
||||
gsub!(/\bfile_open\b/,"rb_file_open")
|
||||
gsub!(/\bfile_s_expand_path\b/,"rb_file_s_expand_path")
|
||||
gsub!(/\bmFileTest\b/,"rb_mFileTest")
|
||||
gsub!(/\bdata_object_alloc\b/,"rb_data_object_alloc")
|
||||
gsub!(/\bgc_call_finalizer_at_exit\b/,"rb_gc_call_finalizer_at_exit")
|
||||
gsub!(/\bgc_force_recycle\b/,"rb_gc_force_recycle")
|
||||
gsub!(/\bgc_gc\b/,"rb_gc")
|
||||
gsub!(/\bgc_mark\b/,"rb_gc_mark")
|
||||
gsub!(/\bgc_stack_start\b/,"rb_gc_stack_start")
|
||||
gsub!(/\bmGC\b/,"rb_mGC")
|
||||
gsub!(/\bcHash\b/,"rb_cHash")
|
||||
gsub!(/\benv_path_tainted\b/,"rb_env_path_tainted")
|
||||
gsub!(/\bhash_aref\b/,"rb_hash_aref")
|
||||
gsub!(/\bhash_aset\b/,"rb_hash_aset")
|
||||
gsub!(/\bhash_freeze\b/,"rb_hash_freeze")
|
||||
gsub!(/\bhash_new\b/,"rb_hash_new")
|
||||
gsub!(/\bcIO\b/,"rb_cIO")
|
||||
gsub!(/\beEOFError\b/,"rb_eEOFError")
|
||||
gsub!(/\beIOError\b/,"rb_eIOError")
|
||||
gsub!(/\beof_error\b/,"rb_eof_error")
|
||||
gsub!(/\bf_gets\b/,"rb_f_gets")
|
||||
gsub!(/\bio_binmode\b/,"rb_io_binmode")
|
||||
gsub!(/\bio_check_closed\b/,"rb_io_check_closed")
|
||||
gsub!(/\bio_check_readable\b/,"rb_io_check_readable")
|
||||
gsub!(/\bio_check_writable\b/,"rb_io_check_writable")
|
||||
gsub!(/\bio_close\b/,"rb_io_close")
|
||||
gsub!(/\bio_fptr_finalize\b/,"rb_io_fptr_finalize")
|
||||
gsub!(/\bio_getc\b/,"rb_io_getc")
|
||||
gsub!(/\bio_gets\b/,"rb_io_gets")
|
||||
gsub!(/\bio_gets_method\b/,"rb_io_gets_method")
|
||||
gsub!(/\bio_mode_flags\b/,"rb_io_mode_flags")
|
||||
gsub!(/\bio_reopen\b/,"rb_io_reopen")
|
||||
gsub!(/\bio_unbuffered\b/,"rb_io_unbuffered")
|
||||
gsub!(/\bio_ungetc\b/,"rb_io_ungetc")
|
||||
gsub!(/\bio_write\b/,"rb_io_write")
|
||||
gsub!(/\bRS_default\b/,"ruby_default_rs")
|
||||
gsub!(/\bOFS\b/,"ruby_output_fs")
|
||||
gsub!(/\bORS\b/,"ruby_output_rs")
|
||||
gsub!(/\bFS\b/,"ruby_fs")
|
||||
gsub!(/\bRS\b/,"ruby_rs")
|
||||
gsub!(/\bmMath\b/,"rb_mMath")
|
||||
gsub!(/\bcFixnum\b/,"rb_cFixnum")
|
||||
gsub!(/\bcFloat\b/,"rb_cFloat")
|
||||
gsub!(/\bcInteger\b/,"rb_cInteger")
|
||||
gsub!(/\bcNumeric\b/,"rb_cNumeric")
|
||||
gsub!(/\beZeroDiv\b/,"rb_eZeroDiv")
|
||||
gsub!(/\bfix2int\b/,"rb_fix2int")
|
||||
gsub!(/\bfix2str\b/,"rb_fix2str")
|
||||
gsub!(/\bfix_upto\b/,"rb_fix_upto")
|
||||
gsub!(/\bfloat_new\b/,"rb_float_new")
|
||||
gsub!(/\bnum2fix\b/,"rb_num2fix")
|
||||
gsub!(/\bnum2int\b/,"rb_num2int")
|
||||
gsub!(/\bnum2long\b/,"rb_num2long")
|
||||
gsub!(/\bnum2ulong\b/,"rb_num2ulong")
|
||||
gsub!(/\bnum_coerce_bin\b/,"rb_num_coerce_bin")
|
||||
gsub!(/\bnum_zerodiv\b/,"rb_num_zerodiv")
|
||||
gsub!(/\bany_to_s\b/,"rb_any_to_s")
|
||||
gsub!(/\bcClass\b/,"rb_cClass")
|
||||
gsub!(/\bcData\b/,"rb_cData")
|
||||
gsub!(/\bcFalseClass\b/,"rb_cFalseClass")
|
||||
gsub!(/\bcModule\b/,"rb_cModule")
|
||||
gsub!(/\bcNilClass\b/,"rb_cNilClass")
|
||||
gsub!(/\bcObject\b/,"rb_cObject")
|
||||
gsub!(/\bcTrueClass\b/,"rb_cTrueClass")
|
||||
gsub!(/\bmKernel\b/,"rb_mKernel")
|
||||
gsub!(/\bnum2dbl\b/,"rb_num2dbl")
|
||||
gsub!(/\bobj_alloc\b/,"rb_obj_alloc")
|
||||
gsub!(/\bobj_equal\b/,"rb_obj_equal")
|
||||
gsub!(/\bobj_is_instance_of\b/,"rb_obj_is_instance_of")
|
||||
gsub!(/\bobj_is_kind_of\b/,"rb_obj_is_kind_of")
|
||||
gsub!(/\bstr2cstr\b/,"rb_str2cstr")
|
||||
gsub!(/\bTopSelf\b/,"rb_top_self")
|
||||
gsub!(/\bbackref_get\b/,"rb_backref_get")
|
||||
gsub!(/\bbackref_set\b/,"rb_backref_set")
|
||||
gsub!(/\bcompile_file\b/,"rb_compile_file")
|
||||
gsub!(/\bcompile_string\b/,"rb_compile_string")
|
||||
gsub!(/\bid_attrset\b/,"rb_id_attrset")
|
||||
gsub!(/\bis_const_id\b/,"rb_is_const_id")
|
||||
gsub!(/\bis_instance_id\b/,"rb_is_instance_id")
|
||||
gsub!(/\blastline_get\b/,"rb_lastline_get")
|
||||
gsub!(/\blastline_set\b/,"rb_lastline_set")
|
||||
gsub!(/\bnode_newnode\b/,"rb_node_newnode")
|
||||
gsub!(/\byyappend_print\b/,"rb_parser_append_print")
|
||||
gsub!(/\byywhile_loop\b/,"rb_parser_while_loop")
|
||||
gsub!(/\brb_reserved_word\b/,"rb_reserved_word")
|
||||
gsub!(/\bsourcefile\b/,"ruby_sourcefile")
|
||||
gsub!(/\bsourceline\b/,"ruby_sourceline")
|
||||
gsub!(/\bmProcess\b/,"rb_mProcess")
|
||||
gsub!(/\bcRange\b/,"rb_cRange")
|
||||
gsub!(/\brange_beg_end\b/,"rb_range_beg_end")
|
||||
gsub!(/\brange_new\b/,"rb_range_new")
|
||||
gsub!(/\bcRegexp\b/,"rb_cRegexp")
|
||||
gsub!(/\bignorecase\b/,"rb_ignorecase")
|
||||
gsub!(/\breg_free\b/,"rb_reg_free")
|
||||
gsub!(/\breg_last_match\b/,"rb_reg_last_match")
|
||||
gsub!(/\breg_match\b/,"rb_reg_match")
|
||||
gsub!(/\breg_new\b/,"rb_reg_new")
|
||||
gsub!(/\breg_nth_defined\b/,"rb_reg_nth_defined")
|
||||
gsub!(/\breg_nth_match\b/,"rb_reg_nth_match")
|
||||
gsub!(/\breg_options\b/,"rb_reg_options")
|
||||
gsub!(/\breg_prepare_re\b/,"rb_reg_prepare_re")
|
||||
gsub!(/\breg_regcomp\b/,"rb_reg_regcomp")
|
||||
gsub!(/\breg_regsub\b/,"rb_reg_regsub")
|
||||
gsub!(/\breg_search\b/,"rb_reg_search")
|
||||
gsub!(/\bstr_cicmp\b/,"rb_str_cicmp")
|
||||
gsub!(/\bf_kill\b/,"rb_f_kill")
|
||||
gsub!(/\bgc_mark_trap_list\b/,"rb_gc_mark_trap_list")
|
||||
gsub!(/\bprohibit_interrupt\b/,"rb_prohibit_interrupt")
|
||||
gsub!(/\btrap_exec\b/,"rb_trap_exec")
|
||||
gsub!(/\btrap_exit\b/,"rb_trap_exit")
|
||||
gsub!(/\btrap_immediate\b/,"rb_trap_immediate")
|
||||
gsub!(/\btrap_pending\b/,"rb_trap_pending")
|
||||
gsub!(/\btrap_restore_mask\b/,"rb_trap_restore_mask")
|
||||
gsub!(/\bposix_signal\b/,"ruby_posix_signal")
|
||||
gsub!(/\bf_sprintf\b/,"rb_f_sprintf")
|
||||
gsub!(/\bcString\b/,"rb_cString")
|
||||
gsub!(/\bobj_as_string\b/,"rb_obj_as_string")
|
||||
gsub!(/\bstr_cat\b/,"rb_str_cat")
|
||||
gsub!(/\bstr_cmp\b/,"rb_str_cmp")
|
||||
gsub!(/\bstr_concat\b/,"rb_str_concat")
|
||||
gsub!(/\bstr_dup\b/,"rb_str_dup")
|
||||
gsub!(/\bstr_dup_frozen\b/,"rb_str_dup_frozen")
|
||||
gsub!(/\bstr_freeze\b/,"rb_str_freeze")
|
||||
gsub!(/\bstr_hash\b/,"rb_str_hash")
|
||||
gsub!(/\bstr_inspect\b/,"rb_str_inspect")
|
||||
gsub!(/\bstr_modify\b/,"rb_str_modify")
|
||||
gsub!(/\bstr_new([234]?)\b/,"rb_str_new\\1")
|
||||
gsub!(/\bstr_plus\b/,"rb_str_plus")
|
||||
gsub!(/\bstr_resize\b/,"rb_str_resize")
|
||||
gsub!(/\bstr_split\b/,"rb_str_split")
|
||||
gsub!(/\bstr_substr\b/,"rb_str_substr")
|
||||
gsub!(/\bstr_taint\b/,"rb_str_taint")
|
||||
gsub!(/\bstr_tainted\b/,"rb_str_tainted")
|
||||
gsub!(/\bstr_times\b/,"rb_str_times")
|
||||
gsub!(/\bstr_to_str\b/,"rb_str_to_str")
|
||||
gsub!(/\bstr_upto\b/,"rb_str_upto")
|
||||
gsub!(/\bcStruct\b/,"rb_cStruct")
|
||||
gsub!(/\bstruct_alloc\b/,"rb_struct_alloc")
|
||||
gsub!(/\bstruct_aref\b/,"rb_struct_aref")
|
||||
gsub!(/\bstruct_aset\b/,"rb_struct_aset")
|
||||
gsub!(/\bstruct_define\b/,"rb_struct_define")
|
||||
gsub!(/\bstruct_getmember\b/,"rb_struct_getmember")
|
||||
gsub!(/\bstruct_new\b/,"rb_struct_new")
|
||||
gsub!(/\bcTime\b/,"rb_cTime")
|
||||
gsub!(/\btime_new\b/,"rb_time_new")
|
||||
gsub!(/\btime_timeval\b/,"rb_time_timeval")
|
||||
gsub!(/\bscan_hex\b/,"ruby_scan_hex")
|
||||
gsub!(/\bscan_oct\b/,"ruby_scan_oct")
|
||||
gsub!(/\bconst_defined\b/,"rb_const_defined")
|
||||
gsub!(/\bconst_defined_at\b/,"rb_const_defined_at")
|
||||
gsub!(/\bconst_get\b/,"rb_const_get")
|
||||
gsub!(/\bconst_get_at\b/,"rb_const_get_at")
|
||||
gsub!(/\bconst_set\b/,"rb_const_set")
|
||||
gsub!(/\bf_autoload\b/,"rb_f_autoload")
|
||||
gsub!(/\bf_global_variables\b/,"rb_f_global_variables")
|
||||
gsub!(/\bf_trace_var\b/,"rb_f_trace_var")
|
||||
gsub!(/\bf_untrace_var\b/,"rb_f_untrace_var")
|
||||
gsub!(/\bmod_const_at\b/,"rb_mod_const_at")
|
||||
gsub!(/\bmod_const_of\b/,"rb_mod_const_of")
|
||||
gsub!(/\bmod_constants\b/,"rb_mod_constants")
|
||||
gsub!(/\bmod_name\b/,"rb_mod_name")
|
||||
gsub!(/\bmod_remove_const\b/,"rb_mod_remove_const")
|
||||
gsub!(/\bobj_instance_variables\b/,"rb_obj_instance_variables")
|
||||
gsub!(/\bobj_remove_instance_variable\b/,"rb_obj_remove_instance_variable")
|
||||
gsub!(/\bshow_copyright\b/,"ruby_show_copyright")
|
||||
gsub!(/\bshow_version\b/,"ruby_show_version")
|
||||
gsub!(/\bdebug\b/,"rb_debug")
|
||||
gsub!(/\bverbose\b/,"rb_verbose")
|
||||
gsub!(/\bFail\(/,"rb_raise(rb_eRuntimeError, ")
|
||||
gsub!(/\bArgError\(/,"rb_raise(rb_eArgError, ")
|
||||
gsub!(/\bTypeError\(/,"rb_raise(rb_eTypeError, ")
|
||||
gsub!(/\bNameError\(/,"rb_raise(rb_eNameError, ")
|
||||
gsub!(/\bIndexError\(/,"rb_raise(rb_eIndexError, ")
|
||||
gsub!(/\bError\b/,"rb_compile_error")
|
||||
gsub!(/\bErrorAppend\b/,"rb_compile_error_append")
|
||||
gsub!(/\bTRUE\b/,"Qtrue")
|
||||
gsub!(/\bFALSE\b/,"Qfalse")
|
||||
gsub!(/\berrinfo\b/,"rb_errinfo")
|
Loading…
Reference in a new issue