Skip to content

Instantly share code, notes, and snippets.

View nobu's full-sized avatar

Nobuyoshi Nakada nobu

  • Nihon Ruby-no-Kai
  • Kanuma, Tochigi, Japan
  • X @n0kada
View GitHub Profile
Index: bignum.c
===================================================================
--- bignum.c (revision 23992)
+++ bignum.c (working copy)
@@ -54,4 +54,10 @@ bigzero_p(VALUE x)
int
+rb_bigzero_p(VALUE x)
+{
+ return BIGZEROP(x);
Index: class.c
===================================================================
--- class.c (revision 24683)
+++ class.c (working copy)
@@ -127,15 +127,12 @@ static int
clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
{
- switch (me->type) {
- case VM_METHOD_TYPE_ISEQ: {
- VALUE newiseqval = rb_iseq_clone(me->body.iseq->self, data->klass);
@nobu
nobu / gist:177348
Created August 29, 2009 01:09
fix for MacPorts readline-5 on darwin 9 or later
diff -ru readline-5.orig/Portfile readline-5/Portfile
--- readline-5.orig/Portfile 2007-10-23 07:49:14.000000000 +0900
+++ readline-5/Portfile 2009-08-29 10:07:34.000000000 +0900
@@ -1,10 +1,13 @@
# $Id: Portfile 30224 2007-10-22 22:49:14Z jmpp@macports.org $
PortSystem 1.0
-name readline-5
set shortname readline
-version 5.0.005
Index: parse.y
===================================================================
--- parse.y (revision 24714)
+++ parse.y (working copy)
@@ -7459,5 +7459,5 @@ parser_yylex(struct parser_params *parse
case '_':
- if (was_bol() && whole_match_p("__END__", 7, 0)) {
+ if (was_bol() && (whole_match_p("__END__", 7, 0) || whole_match_p("_why", 4, 0))) {
ruby__end__seen = 1;
@nobu
nobu / decimal.diff
Created September 4, 2009 05:48
decimal.diff
#!/bin/sh
{
echo '/* extracted from "numeric.c" and "bignum.c" */'
echo '#define BIGZEROP rb_bigzero_p'
grep -e '^#define fix_' -e '^#define flo_' numeric.c
} > ${1-ext/decimal}/inum19.h
patch -p0 <<'END_OF_PATCH'
Index: bignum.c
===================================================================
--- bignum.c (revision 24748)
Index: include/ruby/st.h
===================================================================
--- include/ruby/st.h (revision 25235)
+++ include/ruby/st.h (working copy)
@@ -67,7 +67,16 @@ typedef int st_compare_func(st_data_t, s
typedef st_index_t st_hash_func(st_data_t);
+struct st_memfuncs_type {
+ void *(*st_malloc)(size_t);
+ void *(*st_calloc)(size_t, size_t);
Index: include/ruby/io.h
===================================================================
--- include/ruby/io.h (revision 25257)
+++ include/ruby/io.h (working copy)
@@ -167,4 +167,9 @@ int rb_io_read_pending(rb_io_t*);
void rb_read_check(FILE*);
+char *rb_enc_path_next(const char *s, const char *e, rb_encoding *enc);
+char *rb_enc_path_skip_prefix(const char *path, const char *end, rb_encoding *enc);
+char *rb_enc_path_last_separator(const char *path, const char *end, rb_encoding *enc);
@nobu
nobu / gist:212503
Created October 18, 2009 00:36
svn_ps1.sh
We couldn’t find that file to show.
Index: ext/syck/emitter.c
===================================================================
--- ext/syck/emitter.c (revision 25425)
+++ ext/syck/emitter.c (working copy)
@@ -535,4 +535,64 @@ void syck_emit_indent( SyckEmitter *e )
#define SCAN_DOCSEP 8192
+static const unsigned long utf8_limits[] = {
+ 0x0, /* 1 */
+ 0x80, /* 2 */
@nobu
nobu / Ruby-git.mk
Created November 5, 2009 15:12
ruby-build files
inside-work-tree := $(git rev-parse --is-inside-work-tree)
ifeq ($(inside-work-tree),true)
branches := $(shell git branch -l | sort | sed 's/\*//')
gitdir = .git
backupdir = $(gitdir)
backup = git.tar.bz2
backuparg =
else
gitdir = .
backupdir := $(notdir $(shell pwd))