WINDOWS

標準出力は60KBまで

http://redmine.ruby-lang.org/issues/show/1063 今回のリリースでは直ったのかな?

Zip/Ruby:落ちた…

fcloseで落ちてるっぽい。rubyの関数に置き換えられてんのかな? test.rb:3: [BUG] Segmentation fault ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]-- control frame ---------- c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :open c…

Ruby1.9.1: やっぱりfcloseで落ちてるっぽい

ASRに含まれているrubyは、たぶんruby-1.9.1-p0-i386-mswin32。 VC 9.0だとだめなのかな? #include <stdio.h> #include "ruby.h" static VALUE myfunc(VALUE self) { FILE *f; char buf[256]; f = fopen("C:/foo.txt", "r+b"); fgets(buf, 256, f); printf("%s\n", b</stdio.h>…

Ruby1.9.1: やっぱりfcloseで落ちてるっぽい その2

いろいろやってみる。 /MT→だめ fopen_s→だめ ruby.hを最初にインクルード→だめ msvcrt-ruby191-static.libをリンク→うまくビルドできない…orz WSAAPIを定義してみる→ビルドできない fdopenしてfclose→だめ 追記 _fclose_nolockにしたら一応直った。 たぶん…

Ruby 1.9.1(mswin32)でziprubyをビルドできた

とりあえず、今月中のリリースが目標。 API的な不備はなかったからLinuxでもビルドできると思うけど、環境を用意しないと…。以下、VC2008ビルドメモ。 config.hのバージョンチェックをコメントアウト windows.hをインクルードしない zipruby側のプロジェクト…

Dependency Walker

http://www.dependencywalker.com/ メモ。

ruby.exeのパスを取得する

#include <windows.h> #include "ruby.h" static VALUE ruby_path(VALUE self) { HMODULE hModule; char path[_MAX_PATH]; hModule = GetModuleHandleA(NULL); GetModuleFileNameA(hModule, path, _MAX_PATH); return rb_str_new2(path); } __declspec(dllexport) void </windows.h>…

AquesTalk/Ruby(作りかけ)

http://storehouse.sakura.ne.jp/viewvc/viewvc.cgi/aqtk-ruby/?root=svn だいたい出来てきた。特徴としては… KAKASIを組み込んであるので(ある程度)漢字が読める 辞書をリソースとして取り込んでいるので、一応、辞書いらず やること。 英語をなんとかする …

一時ファイルを作ってファイル閉じたらすぐ削除

#include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> #include <fcntl.h> #include <share.h> char *make_tempfile(void *data, int len) { char *filnam; int fd; char tmpdirnam[_MAX_PATH]; char tmpfilnam[_MAX_PATH]; in…</share.h></fcntl.h></io.h></sys/stat.h></sys/types.h></string.h></stdlib.h></stdio.h></windows.h>

拡張ライブラリにリソースを埋め込む

#include <windows.h> #include "resource.h" #include "ruby.h" static HINSTANCE hDll; static VALUE get_rc(VALUE self) { VALUE str; HRSRC hRc; HGLOBAL hGm; LPVOID p; long size; hRc = FindResourceA(hDll, MAKEINTRESOURCEA(IDR_TEXT1), "TEXT"); if (hRc == N</windows.h>…

一時ファイルを作ってファイル閉じたらすぐ削除 その2

fcloseを使ってみる。 #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> #include <fcntl.h> #include <share.h> char *make_tempfile(void *data, int len) { char *filnam; int fd; char tmpdirnam[_MAX_PATH]; char tmpfilnam[…</share.h></fcntl.h></io.h></sys/stat.h></sys/types.h></string.h></stdlib.h></stdio.h></windows.h>

文字列リソースを使う

#include <windows.h> #include "resource.h" #include <stdio.h> int main() { char buf[BUFSIZ]; LoadStringA(NULL, IDS_STRING101, buf, BUFSIZ); puts(buf); return 0; } テスト 続行するには何かキーを押してください . . .</stdio.h></windows.h>

リソースに埋め込んだファイルを読み込む

#include <windows.h> #include "resource.h" #include <stdio.h> int main() { HRSRC hrc; HGLOBAL hgb; LPVOID p; hrc = FindResourceA(NULL, MAKEINTRESOURCEA(IDR_TEXT1), "TEXT"); printf("%d\n", SizeofResource(NULL, hrc)); hgb = LoadResource(NULL, hrc); p = LockReso</stdio.h></windows.h>…

aqtk: AquesTalk Ruby拡張

http://storehouse.sakura.ne.jp/viewvc/viewvc.cgi/aqtk/?root=svn http://aqtk.rubyforge.org/ ※リリース済み Win32専用。実行にはAquesTalkのDLLが必要。 そのうちRubyForgeに登録して、CodeReposに移す予定。 使い方はこんな感じ。 require 'aqtk' # 再…

KAKASIを使って増田を音声読み上げ

ソースはこれ。 汎用化しようとするとnormalizeがたいへんそうな気が。 $KCODE = 's' ENV['KANWADICTPATH'] = 'C:\usr\local\kakasi\share\kakasi\kanwadict' ENV['ITAIJIDICTPATH'] = 'C:\usr\local\kakasi\share\kakasi\itaijidict' require 'rubygems' re…

TaskCollection

http://labo.piny.jp/taskcollection/ Exposeもどき。軽い。

andLinuxのインスコ

x61sにandLinuxをインスコ。TAPアドレスを変更したら、Launcherからアプリが起動しなくなって、ちとハマった。 ひゃまだのテキストで行こう - andlinux にょろぷにらん | andLinux インストールからデフォルトのIPアドレスを変更するまで - すぱいだー日記。

Mercurial plugin for MS Visual Studio

http://www.selenic.com/pipermail/mercurial/2008-May/019246.html ちょっと使ってみよう。

VC: dllを作る・使う

mydll.c __declspec(dllexport) void foo(); #include <stdio.h> void foo() { puts("foo()"); } 暗黙的リンク インポートライブラリ「mydll.lib」*1をリンクする。 関数の場合「__declspec(dllimport)」は必須でないみたい。 __declspec(dllimport) void foo(); int </stdio.h>…

Cygwin: dllを作る・使う

http://www.nslabs.jp/cygwin-dll.rhtml foo.c 「__declspec(dllexport)」は不要…と。 #include <stdio.h> void foo() { puts("foo()"); } 「-fPIC」は不要…と。 ~/work$ gcc -c foo.c ~/work$ gcc -shared foo.o -o foo.dll 暗黙的リンク void foo(); int main() { f</stdio.h>…

opendir・readdir・closedirをエミュレートする

空のディレクトリの動作が違いそうな…。 #include <stdio.h> #include <errno.h> #include "dirent.h" int main() { DIR *dir; struct dirent *entry; if ((dir = opendir("/usr/local")) == NULL) { perror("opendir(3)"); exit(1); } entry = readdir(dir); while (entry) { </errno.h></stdio.h>…

link: パス フィールドの制限

http://msdn.microsoft.com/ja-jp/library/930f87yf(VS.80).aspx

共有メモリを使う

OSの差異はどうとでも吸収できそう。 #include <windows.h> #include <stdio.h> #include <stdlib.h> #define SHM_SIZE 256 #define die(fmt, ...) \ do { \ fprintf(stderr, fmt, __VA_ARGS__); \ exit(1); \ } while(0) int main() { HANDLE hShm; void *p; hShm = CreateFileMappingA((H</stdlib.h></stdio.h></windows.h>…

Fiberでコルーチン

RubyじゃなくてWindows APIのほう。 Unixだとノンプリエンティブなスレッドってどうやって使うんだろう? #include <windows.h> #include <stdio.h> #include <stdlib.h> #define die(fmt, ...) \ do { \ fprintf(stderr, fmt, __VA_ARGS__); \ exit(1); \ } while(0) void _stdcall fiber(</stdlib.h></stdio.h></windows.h>…

VC++2008よいかも。。。

ノートにVCがインストールされていなかったので、VC++2008とPlatform SDKをインスコ。emacsのキーバインドで使っていたら、オートインデントがemacs並に強力*1なことに気がついた。これイイ!ほかのマシンの2005も2008にしようかなー。 *1:あの何度Tabを押し…

「Windowsで」Apacheモジュールをビルドする

意外とあっさりできたのでびっくり。 ひな形を作る apxsをWindowsにインストールするのは大変そうなので、ここだけLinuxで実行。 ~/work# apxs -g -n test Creating [DIR] test Creating [FILE] test/Makefile Creating [FILE] test/modules.mk Creating [FI…

link: X41T…Officeでファイルを開くと待たされる

http://www.proteus.jp/MT/archives/2006/0726_1041_3393.php とりあえずOFFにした。

dbm.so

http://www.garbagecollect.jp/ruby/mswin32/ja/download/release.html ASRには含まれていないので、ruby-1.8.6-i386-mswin32.zipからdbm.soとgdbm.soをゲット。あと、Porting Libraries to Win32からgdbm.dllをゲットして、%RUBY_HOME%\binに置く。 http://…

link: Apache Binaries

http://hunter.campbus.com/ なぜかApacheがうまくインストールできなかったので、上のサイトからダウンロード。 うーん…

link: Windows XP Home Editionでまともなユーザー管理をさせて!

http://mag.autumn.org/Content.modf?id=20031125212536 めもめも。