Skip to content

Instantly share code, notes, and snippets.

diff --git a/ext/fiddle/conversions.c b/ext/fiddle/conversions.c
index bb5361a..2291829 100644
--- a/ext/fiddle/conversions.c
+++ b/ext/fiddle/conversions.c
@@ -1,5 +1,55 @@
#include <fiddle.h>
+#undef ffi_type_uchar
+#undef ffi_type_schar
+#undef ffi_type_ushort
../../configure --prefix=~/local --program-suffix=-1.9.2 --with-rubylibprefix=~/local/lib/ruby-1.9.2 --with-soname=ruby-1.9.2 --with-ridir=~/local/share/ri-1.9.2 --with-rubyhdrdir=~/local/include/ruby-1.9.1-1.9.2 --with-gdbm-dir=/opt/local --with-libyaml-dir=/opt/local --with-libffi-dir=/opt/local --with-arch=i386 CC="ccache gcc"
@yugui
yugui / extension.ja.rdoc
Last active May 27, 2023 08:36
extension.ja.rdoc -- extension library

CのデータをRubyオブジェクトにする

Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして取り扱いたい場合がありえます.このような場合はTypedData_XXX マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互いに変換できます.

# 古い(非Typedな)Data_XXXマクロ群は非推奨になりました.

# 将来のバージョンのRubyでは古いマクロは動作しなくなる可能性があります.

@yugui
yugui / build.sh
Last active May 7, 2016 02:08
Objective C99++11
g++ -framework Foundation -std=gnu++14 -lobjc test.mm
syntax = "proto3";
package example;
message Example {
oneof oneof_field {
string string_value = 1;
int32 int32_value = 2;
}
}
package main
import (
"log"
"github.com/golang/protobuf/jsonpb"
)
func main() {
const input = `{"create_request": {"key": "Zm9v"}}`
load("@com_github_gengo_rules_pypi//pypi:def.bzl", "pypi_universal_repository")
BUILD_FILE = """
py_library(
name = "library",
srcs = glob(["lib/python*/site-packages/**/*.py"]),
imports = [
"lib/python2.7/site-packages",
"lib/python3.5/site-packages",
],
@yugui
yugui / romantable.txt
Last active November 14, 2016 05:03
roman-kana mapping table for Google Japanese Input to type Japanese characters with ANSI keyboard
3 あ
e い
4 う
5 え
6 お
# ぁ
E ぃ
$ ぅ
% ぇ
^ ぉ
On the 6th of May, 1709, I took a solemn leave of his majesty, and
all
my friends. This prince was so gracious as to order a guard to
conduct me to Glanguenstald, which is a royal port to the south-
west part of the island. In six days I found a vessel ready to
carry me to Japan, and spent fifteen days in the voyage.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: custom-options.proto
/*
Package main is a generated protocol buffer package.
It is generated from these files:
custom-options.proto
It has these top-level messages: