diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-14 04:10:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-14 04:10:39 +0000 |
commit | c25084921670dfe33a0871ee7b94c102fea0ea3a (patch) | |
tree | f0df3bfdc54529ba5c345f5536f7164acf7746d4 | |
parent | ae2fe781dd4aae16a2f03a4b9fb93514eb9886d4 (diff) |
prototypes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | README.EXT | 198 | ||||
-rw-r--r-- | README.EXT.jp | 210 | ||||
-rw-r--r-- | README.jp | 2 | ||||
-rw-r--r-- | array.c | 4 | ||||
-rw-r--r-- | class.c | 4 | ||||
-rw-r--r-- | config.dj | 6 | ||||
-rw-r--r-- | configure | 652 | ||||
-rw-r--r-- | configure.in | 51 | ||||
-rw-r--r-- | error.c | 32 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | ext/gtk/gtk.c | 2 | ||||
-rw-r--r-- | intern.h | 16 | ||||
-rw-r--r-- | pack.c | 6 | ||||
-rw-r--r-- | regex.c | 4 | ||||
-rw-r--r-- | ruby.h | 53 | ||||
-rw-r--r-- | struct.c | 6 | ||||
-rw-r--r-- | win32/config.h | 6 | ||||
-rw-r--r-- | win32/ruby.def | 10 |
19 files changed, 715 insertions, 554 deletions
@@ -3,7 +3,7 @@ Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in -perl). It is simple, straight-forward, and extensible. +Perl). It is simple, straight-forward, and extensible. * Features of Ruby @@ -97,7 +97,7 @@ You can redistribute it and/or modify it under either the terms of the GPL are not written by the author, so that they are not under this terms. They are gc.c(partly), utils.c(partly), regex.[ch], fnmatch.[ch], glob.c, st.[ch] and some files under the ./missing directory. See - each files for the copying condition. + each file for the copying condition. 5. The scripts and library files supplied as input to or produced as output from the software do not automatically fall under the diff --git a/README.EXT b/README.EXT index c2f81d1a7a..7d2d6456c4 100644 --- a/README.EXT +++ b/README.EXT @@ -1,21 +1,16 @@ .\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995 -This document explains how to make extention modules for ruby. +This document explains how to make extention modules for Ruby. 1.Basic knowledge In C, variables have types and data do not have types. In contrast, -ruby variables do not have static type and data themselves have +Ruby variables do not have static type and data themselves have types. So, data need to be converted across the languages. -Data in ruby represented C type `VALUE'. Each VALUE data have its +Data in Ruby represented C type `VALUE'. Each VALUE data have its data-type. -rubyのデータはVALUEというCの型で表現されます.VALUE型のデー -タはそのデータタイプを自分で知っています.このデータタイプと -いうのはデータ(オブジェクト)の実際の構造を意味していて,ruby -のクラスとはまた違ったものです. - To retrieve an C data from the VALUE, you need to: (1) Identify VALUE's data type @@ -38,7 +33,7 @@ Ruby interpreter has data-types as below: T_ARRAY array T_FIXNUM Fixnum(31bit integer) T_HASH assosiative array - T_STRUCT (ruby) structure + T_STRUCT (Ruby) structure T_BIGNUM multi precision integer T_TRUE true T_FALSE false @@ -90,12 +85,12 @@ There are faster check-macros for fixnums and nil. 1.3 Convert VALUE into C data データタイプがT_NIL, T_FALSE, T_TRUEである時,データはそれぞ -れnil, FALSE, TRUEです.このデータタイプのオブジェクトはひと +れnil, false, trueです.このデータタイプのオブジェクトはひと つずつしか存在しません. データタイプがT_FIXNUMの時,これは31bitのサイズを持つ整数で す.FIXNUMをCの整数に変換するためにはマクロ「FIX2INT()」を使 -います.それから,FIXNUMに限らずrubyのデータを整数に変換する +います.それから,FIXNUMに限らずRubyのデータを整数に変換する 「NUM2INT()」というマクロがあります.このマクロはデータタイ プのチェック無しで使えます(整数に変換できない場合には例外が 発生する). @@ -116,7 +111,7 @@ ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文 とします.配列の場合には,それぞれ「RARRAT(str)->len」, 「RARRAT(str)->ptr」となります. -rubyの構造体を直接アクセスする時に気をつけなければならないこ +Rubyの構造体を直接アクセスする時に気をつけなければならないこ とは,配列や文字列の構造体の中身は参照するだけで,直接変更し ないことです.直接変更した場合,オブジェクトの内容の整合性が とれなくなって,思わぬバグの原因になります. @@ -137,10 +132,10 @@ VALUEの実際の構造は うかわかるわけです(ポインタのLSBが立っていないことを仮定して いる). -ですから,FIXNUM以外のrubyのオブジェクトの構造体は単にVALUE +ですから,FIXNUM以外のRubyのオブジェクトの構造体は単にVALUE にキャストするだけでVALUEに変換出来ます.ただし,任意の構造 体がVALUEにキャスト出来るわけではありません.キャストするの -はrubyの知っている構造体(ruby.hで定義されているstruct RXxxx +はRubyの知っている構造体(ruby.hで定義されているstruct RXxxx のもの)だけにしておいてください. FIXNUMに関しては変換マクロを経由する必要があります.Cの整数 @@ -153,11 +148,11 @@ FIXNUMに関しては変換マクロを経由する必要があります.Cの整数 INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換 してくれます(が,少し遅い). -1.5 Manipulate ruby data +1.5 Manipulate Ruby data -先程も述べた通り,rubyの構造体をアクセスする時に内容の更新を -行うことは勧められません.で,rubyのデータを操作する時には -rubyが用意している関数を用いてください. +先程も述べた通り,Rubyの構造体をアクセスする時に内容の更新を +行うことは勧められません.で,Rubyのデータを操作する時には +Rubyが用意している関数を用いてください. ここではもっとも使われるであろう文字列と配列の生成/操作を行 い関数をあげます(全部ではないです). @@ -166,16 +161,16 @@ rubyが用意している関数を用いてください. str_new(char *ptr, int len) - Creates a new ruby string. + Creates a new Ruby string. str_new2(char *ptr) - Creates a new ruby string from C string. This is equivalent to + Creates a new Ruby string from C string. This is equivalent to str_new(ptr, strlen(ptr)). str_cat(VALUE str, char *ptr, int len) - Appends len bytes data from ptr to the ruby string. + Appends len bytes data from ptr to the Ruby string. Array functions @@ -205,17 +200,17 @@ rubyが用意している関数を用いてください. Array operations. The first argument to each functions must be an array. They may dump core if other types given. -2. Extend ruby with C +2. Extend Ruby with C -原理的にrubyで書けることはCでも書けます.rubyそのものがCで記 +原理的にRubyで書けることはCでも書けます.RubyそのものがCで記 述されているんですから,当然といえば当然なんですけど.ここで -はrubyの拡張に使うことが多いだろうと予測される機能を中心に紹 +はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹 介します. -2.1 Add new features to ruby +2.1 Add new features to Ruby -rubyで提供されている関数を使えばrubyインタプリタに新しい機能 -を追加することができます.rubyでは以下の機能を追加する関数が +Rubyで提供されている関数を使えばRubyインタプリタに新しい機能 +を追加することができます.Rubyでは以下の機能を追加する関数が 提供されています. * クラス,モジュール @@ -247,7 +242,7 @@ rubyで提供されている関数を使えばrubyインタプリタに新しい機能 念のため説明すると「特異メソッド」とは,その特定のオブジェク -トに対してだけ有効なメソッドです.rubyではよくSmalltalkにお +トに対してだけ有効なメソッドです.RubyではよくSmalltalkにお けるクラスメソッドとして,クラスに対する特異メソッドが使われ ます. @@ -258,7 +253,7 @@ rubyで提供されている関数を使えばrubyインタプリタに新しい機能 argcが負の時は引数の数ではなく,形式を指定したことになります. argcが-1の時は引数を配列に入れて渡されます.argcが-2の時は引 -数はrubyの配列として渡されます. +数はRubyの配列として渡されます. メソッドを定義する関数はもう二つあります.ひとつはprivateメ ソッドを定義する関数で,引数はrb_define_method()と同じです. @@ -304,21 +299,21 @@ privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ 前者は特定のクラス/モジュールに属する定数を定義するもの,後 者はグローバルな定数を定義するものです. -2.2 Use ruby features from C +2.2 Use Ruby features from C -既に『1.5 rubyのデータを操作する』で一部紹介したような関数を -使えば,rubyの機能を実現している関数を直接呼び出すことが出来 +既に『1.5 Rubyのデータを操作する』で一部紹介したような関数を +使えば,Rubyの機能を実現している関数を直接呼び出すことが出来 ます. # このような関数の一覧表はいまのところありません.ソースを見 # るしかないですね. -それ以外にもrubyの機能を呼び出す方法はいくつかあります. +それ以外にもRubyの機能を呼び出す方法はいくつかあります. -2.2.1 rubyのプログラムをevalする +2.2.1 Rubyのプログラムをevalする -Cからrubyの機能を呼び出すもっとも簡単な方法として,文字列で -与えられたrubyのプログラムを評価する関数があります. +CからRubyの機能を呼び出すもっとも簡単な方法として,文字列で +与えられたRubyのプログラムを評価する関数があります. VALUE rb_eval_string(char *str) @@ -327,11 +322,11 @@ Cからrubyの機能を呼び出すもっとも簡単な方法として,文字列で 2.2.2 ID or Symbol -Cから文字列を経由せずにrubyのメソッドを呼び出すこともできま -す.その前に,rubyインタプリタ内でメソッドや変数名を指定する +Cから文字列を経由せずにRubyのメソッドを呼び出すこともできま +す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する 時に使われているIDについて説明しておきましょう. -IDとは変数名,メソッド名を表す整数です.rubyの中では +IDとは変数名,メソッド名を表す整数です.Rubyの中では :識別子 @@ -342,9 +337,9 @@ IDとは変数名,メソッド名を表す整数です.rubyの中では を使います.また一文字の演算子はその文字コードがそのままシン ボルになっています. -2.2.3 Invoke ruby method from C +2.2.3 Invoke Ruby method from C -Cから文字列を経由せずにrubyのメソッドを呼び出すためには以下 +Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下 の関数を使います. VALUE rb_funcall(VALUE recv, ID mid, int argc, ...) @@ -373,13 +368,13 @@ idはrb_intern()で得られるものを使ってください. クラス定数を新しく定義するためには『2.1.3 定数定義』で紹介さ れている関数を使ってください. -3. Informatin sharing between ruby and C +3. Informatin sharing between Ruby and C -C言語とrubyの間で情報を共有する方法について解説します. +C言語とRubyの間で情報を共有する方法について解説します. -3.1 Ruby constant that Cから参照できるrubyの定数 +3.1 Ruby constant that Cから参照できるRubyの定数 -Following ruby constants can be referred from C. +Following Ruby constants can be referred from C. TRUE FALSE @@ -390,19 +385,19 @@ Boolean values. FALSE is false in the C also (i.e. 0). Ruby nil in C scope. -3.2 Global variables shared between C and ruby +3.2 Global variables shared between C and Ruby -Cとrubyで大域変数を使って情報を共有できます.共有できる大域 +CとRubyで大域変数を使って情報を共有できます.共有できる大域 変数にはいくつかの種類があります.そのなかでもっとも良く使わ れると思われるのはrb_define_variable()です. void rb_define_variable(char *name, VALUE *var) -この関数はrubyとCとで共有する大域変数を定義します.変数名が +この関数はRubyとCとで共有する大域変数を定義します.変数名が `$'で始まらない時には自動的に追加されます.この変数の値を変 -更すると自動的にrubyの対応する変数の値も変わります. +更すると自動的にRubyの対応する変数の値も変わります. -またruby側からは更新できない変数もあります.このread onlyの +またRuby側からは更新できない変数もあります.このread onlyの 変数は以下の関数で定義します. void rb_define_readonly_variable(char *name, VALUE *var) @@ -421,13 +416,13 @@ setterに0を指定します. # getterもsetterも0ならばrb_define_variable()と同じになる. -それから,Cの関数によって実現されるrubyの大域変数を定義する +それから,Cの関数によって実現されるRubyの大域変数を定義する 関数があります. void rb_define_virtual_variable(char *name, VALUE (*getter)(), VALUE (*setter)()) -この関数によって定義されたrubyの大域変数が参照された時には +この関数によって定義されたRubyの大域変数が参照された時には getterが,変数に値がセットされた時にはsetterが呼ばれます. The prototypes of the getter and setter functions are as following: @@ -435,14 +430,14 @@ The prototypes of the getter and setter functions are as following: (*getter)(ID id, void *data, struct global_entry* entry); (*setter)(VALUE val, ID id, void *data, struct global_entry* entry); -3.3 Encapsulate C data into ruby object +3.3 Encapsulate C data into Ruby object -Cの世界で定義されたデータ(構造体)をrubyのオブジェクトとして +Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして 取り扱いたい場合がありえます.このような場合には,Dataという -rubyオブジェクトにCの構造体(へのポインタ)をくるむことでruby +RubyオブジェクトにCの構造体(へのポインタ)をくるむことでRuby オブジェクトとして取り扱えるようになります. -Dataオブジェクトを生成して構造体をrubyオブジェクトにカプセル +Dataオブジェクトを生成して構造体をRubyオブジェクトにカプセル 化するためには,以下のマクロを使います. Data_Wrap_Struct(class,mark,free,ptr) @@ -450,7 +445,7 @@ Dataオブジェクトを生成して構造体をrubyオブジェクトにカプセル このマクロの戻り値は生成されたDataオブジェクトです. classはこのDataオブジェクトのクラスです.ptrはカプセル化する -Cの構造体へのポインタです.markはこの構造体がrubyのオブジェ +Cの構造体へのポインタです.markはこの構造体がRubyのオブジェ クトへの参照がある時に使う関数です.そのような参照を含まない 時には0を指定します. @@ -483,14 +478,14 @@ Cの構造体へのポインタは変数svalに代入されます. 4.Example - Create dbm module ここまでの説明でとりあえず拡張モジュールは作れるはずです. -rubyのextディレクトリにすでに含まれているdbmモジュールを例に +Rubyのextディレクトリにすでに含まれているdbmモジュールを例に して段階的に説明します. (1) make the directory % mkdir ext/dbm -rubyを展開したディレクトリの下,extディレクトリの中に拡張モ +Rubyを展開したディレクトリの下,extディレクトリの中に拡張モ ジュール用のディレクトリを作ります.名前は適当に選んで構いま せん. @@ -522,7 +517,7 @@ MANIFESTというファイルは,makeの時にディレクトリが拡張モジュー ル生成時に中間的に生成される「モジュール名.o」というファイル とが衝突するからです. -rubyは拡張モジュールをロードする時に「Init_モジュール名」と +Rubyは拡張モジュールをロードする時に「Init_モジュール名」と いう関数を自動的に実行します.dbmモジュールの場合「Init_dbm」 です.この関数の中でクラス,モジュール,メソッド,定数などの 定義を行います.dbm.cから一部引用します. @@ -550,7 +545,7 @@ Init_dbm() -- DBMモジュールはdbmのデータと対応するオブジェクトになるはずで -すから,Cの世界のdbmをrubyの世界に取り込む必要があります. +すから,Cの世界のdbmをRubyの世界に取り込む必要があります. dbm.cではData_Make_Structを以下のように使っています. @@ -600,7 +595,7 @@ fdbm_delete(obj, keystr) 引数の数が固定のタイプは第1引数がself,第2引数以降がメソッド の引数となります. -引数の数が不定のものはCの配列で受けるものとrubyの配列で受け +引数の数が不定のものはCの配列で受けるものとRubyの配列で受け るものとがあります.dbmモジュールの中で,Cの配列で受けるもの はDBMのクラスメソッドであるopen()です.これを実装している関 数fdbm_s_open()はこうなっています. @@ -634,7 +629,7 @@ fdbm_s_open(argc, argv, class) で,2つまで許されるという意味になります.省略されている時の 変数の値はnil(C言語のレベルではQnil)になります. -rubyの配列で引数を受け取るものはindexesがあります.実装はこ +Rubyの配列で引数を受け取るものはindexesがあります.実装はこ うです. -- @@ -647,14 +642,14 @@ fdbm_indexes(obj, args) } -- -第1引数はself,第2引数はrubyの配列です.ここではキャストを減 +第1引数はself,第2引数はRubyの配列です.ここではキャストを減 らすため struct RArray* で受けていますが,VALUEでも同じこと です. ** 注意事項 -rubyと共有はしないがrubyのオブジェクトを格納する可能性のある -Cの大域変数は以下の関数を使ってrubyインタプリタに変数の存在 +Rubyと共有はしないがRubyのオブジェクトを格納する可能性のある +Cの大域変数は以下の関数を使ってRubyインタプリタに変数の存在 を教えてあげてください.でないとGCでトラブルを起こします. void rb_global_variable(VALUE *var) @@ -665,7 +660,7 @@ Cの大域変数は以下の関数を使ってrubyインタプリタに変数の存在 make時に実行されます.なければ適当にMakefileが生成されます. extconf.rbはモジュールのコンパイルに必要な条件のチェックなど -を行うことが目的です.extconf.rbの中では以下のruby関数を使う +を行うことが目的です.extconf.rbの中では以下のRuby関数を使う ことが出来ます. have_library(lib, func): ライブラリの存在チェック @@ -704,31 +699,31 @@ make時にはMANIFESTの内容は参照しませんので,空のままでも問題 (8) make -rubyのディレクトリでmakeを実行するとMakefileを生成からmake, -必要によってはそのモジュールのrubyへのリンクまで自動的に実行 +Rubyのディレクトリでmakeを実行するとMakefileを生成からmake, +必要によってはそのモジュールのRubyへのリンクまで自動的に実行 してくれます.extconf.rbを書き換えるなどしてMakefileの再生成 -が必要な時はまたrubyディレクトリでmakeしてください. +が必要な時はまたRubyディレクトリでmakeしてください. (9) debug -まあ,デバッグしないと動かないでしょうね.ext/Setupにディレ -クトリ名を書くと静的にリンクするのでデバッガが使えるようにな -ります.その分コンパイルが遅くなりますけど. +You may need to debug the module. The modules can be linked +statically by adding directory name in the ext/Setup file, +so that you can inspect the module by the debugger. (10) done, now you have the extension module 後はこっそり使うなり,広く公開するなり,売るなり,ご自由にお -使いください.rubyの作者は拡張モジュールに関して一切の権利を +使いください.Rubyの作者は拡張モジュールに関して一切の権利を 主張しません. -Appendix A. rubyのソースコードの分類 +Appendix A. Rubyのソースコードの分類 -rubyのソースはいくつかに分類することが出来ます.このうちクラ +Rubyのソースはいくつかに分類することが出来ます.このうちクラ スライブラリの部分は基本的に拡張モジュールと同じ作り方になっ ています.これらのソースは今までの説明でほとんど理解できると 思います. -coore ruby language +ruby language core class.c error.c @@ -780,13 +775,13 @@ class library Appendix B. 拡張用関数リファレンス -C言語からrubyの機能を利用するAPIは以下の通りである. +C言語からRubyの機能を利用するAPIは以下の通りである. ** 型 VALUE -rubyオブジェクトを表現する型.必要に応じてキャストして用いる. +Rubyオブジェクトを表現する型.必要に応じてキャストして用いる. 組み込み型を表現するCの型はruby.hに記述してあるRで始まる構造 体である.VALUE型をこれらにキャストするためにRで始まる構造体 名を全て大文字にした名前のマクロが用意されている. @@ -809,9 +804,9 @@ const: FALSE object Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval) -Cの任意のポインタをカプセル化したrubyオブジェクトを返す.こ -のポインタがrubyからアクセスされなくなった時,freeで指定した -関数が呼ばれる.また,このポインタの指すデータが他のrubyオブ +Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ +のポインタがRubyからアクセスされなくなった時,freeで指定した +関数が呼ばれる.また,このポインタの指すデータが他のRubyオブ ジェクトを指している場合,markに指定する関数でマークする必要 がある. @@ -828,20 +823,20 @@ dataからtype型のポインタを取り出し変数svalに代入するマクロ. VALUE rb_define_class(char *name, VALUE super) -superのサブクラスとして新しいrubyクラスを定義する. +superのサブクラスとして新しいRubyクラスを定義する. VALUE rb_define_class_under(VALUE module, char *name, VALUE super) -superのサブクラスとして新しいrubyクラスを定義し,moduleの定 +superのサブクラスとして新しいRubyクラスを定義し,moduleの定 数として定義する. VALUE rb_define_module(char *name) -新しいrubyモジュールを定義する. +新しいRubyモジュールを定義する. VALUE rb_define_module_under(VALUE module, char *name, VALUE super) -新しいrubyモジュールを定義し,moduleの定数として定義する. +新しいRubyモジュールを定義し,moduleの定数として定義する. void rb_include_module(VALUE class, VALUE module) @@ -856,20 +851,20 @@ superのサブクラスとして新しいrubyクラスを定義し,moduleの定 void rb_define_variable(char *name, VALUE *var) -rubyとCとで共有するグローバル変数を定義する.変数名が`$'で始 -まらない時には自動的に追加される.nameとしてrubyの識別子とし -て許されない文字(例えば` ')を含む場合にはrubyプログラムから +RubyとCとで共有するグローバル変数を定義する.変数名が`$'で始 +まらない時には自動的に追加される.nameとしてRubyの識別子とし +て許されない文字(例えば` ')を含む場合にはRubyプログラムから は見えなくなる. void rb_define_readonly_variable(char *name, VALUE *var) -rubyとCとで共有するread onlyのグローバル変数を定義する.read +RubyとCとで共有するread onlyのグローバル変数を定義する.read onlyであること以外はrb_define_variable()と同じ. void rb_define_virtual_variable(char *name, VALUE (*getter)(), VALUE (*setter)()) -関数によって実現されるruby変数を定義する.変数が参照された時 +関数によって実現されるRuby変数を定義する.変数が参照された時 にはgetterが,変数に値がセットされた時にはsetterが呼ばれる. void rb_define_hooked_variable(char *name, VALUE *var, @@ -882,7 +877,7 @@ onlyであること以外はrb_define_variable()と同じ. void rb_global_variable(VALUE *var) -GCのため,rubyプログラムからはアクセスされないが, rubyオブジェ +GCのため,Rubyプログラムからはアクセスされないが, Rubyオブジェ クトを含む大域変数をマークする. ** クラス定数 @@ -906,7 +901,7 @@ GCのため,rubyプログラムからはアクセスされないが, rubyオブジェ メソッドを定義する.argcはselfを除く引数の数.argcが-1の時, 関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2引 数とする形式で与えられる(第3引数はself).argcが-2の時, 第1引 -数がself, 第2引数がargs(argsは引数を含むrubyの配列)という形 +数がself, 第2引数がargs(argsは引数を含むRubyの配列)という形 式で与えられる. rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc) @@ -927,7 +922,7 @@ argc,argv形式で与えられた引数を分解する.fmtは必須引数の数, 数に対応する引数が与えられていない場合は変数にQnilが代入され る. -** rubyメソッド呼び出し +** Rubyメソッド呼び出し VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) @@ -939,7 +934,7 @@ argc,argv形式で与えられた引数を分解する.fmtは必須引数の数, VALUE rb_eval_string(char *str) -文字列をrubyとスクリプトしてコンパイル・実行する. +文字列をRubyとスクリプトしてコンパイル・実行する. ID rb_intern(char *name) @@ -959,7 +954,7 @@ classの名前を返す(デバッグ用).classが名前を持たない時には, VALUE rb_iv_get(VALUE obj, char *name) objのインスタンス変数の値を得る.`@'で始まらないインスタンス -変数は rubyプログラムからアクセスできない「隠れた」インスタ +変数は Rubyプログラムからアクセスできない「隠れた」インスタ ンス変数になる. VALUE rb_iv_set(VALUE obj, char *name, VALUE val) @@ -1013,22 +1008,23 @@ verbose時に標準エラー出力に警告情報を表示する.引数はprintf()と同じ. 況の時呼ぶ.インタープリタはコアダンプし直ちに終了する.例外 処理は一切行なわれない. -** rubyの初期化・実行 +** Rubyの初期化・実行 -rubyをアプリケーションに埋め込む場合には以下のインタフェース +Rubyをアプリケーションに埋め込む場合には以下のインタフェース を使う.通常の拡張モジュールには必要ない. void ruby_init(int argc, char **argv, char **envp) -rubyインタプリタの初期化を行なう. +Rubyインタプリタの初期化を行なう. void ruby_run() -rubyインタプリタを実行する. +Rubyインタプリタを実行する. void ruby_script(char *name) -rubyのスクリプト名($0)を設定する. +Rubyのスクリプト名($0)を設定する. + Appendix B. extconf.rbで使える関数たち diff --git a/README.EXT.jp b/README.EXT.jp index 2ad397dde3..2929f1b2d1 100644 --- a/README.EXT.jp +++ b/README.EXT.jp @@ -1,18 +1,18 @@ .\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995 -rubyの拡張モジュールの作り方を説明します. +Rubyの拡張モジュールの作り方を説明します. 1.基礎知識 Cの変数には型があり,データには型がありません.ですから,た とえばポインタをintの変数に代入すると,その値は整数として取 -り扱われます.逆にrubyの変数には型がなく,データに型がありま -す.この違いのため,Cとrubyは相互に変換しなければ,お互いの +り扱われます.逆にRubyの変数には型がなく,データに型がありま +す.この違いのため,CとRubyは相互に変換しなければ,お互いの データをアクセスできません. -rubyのデータはVALUEというCの型で表現されます.VALUE型のデー +RubyのデータはVALUEというCの型で表現されます.VALUE型のデー タはそのデータタイプを自分で知っています.このデータタイプと -いうのはデータ(オブジェクト)の実際の構造を意味していて,ruby +いうのはデータ(オブジェクト)の実際の構造を意味していて,Ruby のクラスとはまた違ったものです. VALUEからCにとって意味のあるデータを取り出すためには @@ -25,7 +25,7 @@ VALUEからCにとって意味のあるデータを取り出すためには 1.1 データタイプ -rubyにはユーザが使う可能性のある以下のタイプがあります. +Rubyにはユーザが使う可能性のある以下のタイプがあります. T_NIL nil T_OBJECT 通常のオブジェクト @@ -37,7 +37,7 @@ rubyにはユーザが使う可能性のある以下のタイプがあります. T_ARRAY 配列 T_FIXNUM Fixnum(31bit長整数) T_HASH 連想配列 - T_STRUCT (rubyの)構造体 + T_STRUCT (Rubyの)構造体 T_BIGNUM 多倍長整数 T_FILE 入出力 T_TRUE 真 @@ -99,7 +99,7 @@ FIXNUMとNILに関してはより高速な判別マクロが用意されています. データタイプがT_FIXNUMの時,これは31bitのサイズを持つ整数で す.FIXNUMをCの整数に変換するためにはマクロ「FIX2INT()」を使 -います.それから,FIXNUMに限らずrubyのデータを整数に変換する +います.それから,FIXNUMに限らずRubyのデータを整数に変換する 「NUM2INT()」というマクロがあります.このマクロはデータタイ プのチェック無しで使えます(整数に変換できない場合には例外が 発生する). @@ -123,7 +123,7 @@ ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文 とします.配列の場合には,それぞれ「RARRAY(str)->len」, 「RARRAY(str)->ptr」となります. -rubyの構造体を直接アクセスする時に気をつけなければならないこ +Rubyの構造体を直接アクセスする時に気をつけなければならないこ とは,配列や文字列の構造体の中身は参照するだけで,直接変更し ないことです.直接変更した場合,オブジェクトの内容の整合性が とれなくなって,思わぬバグの原因になります. @@ -144,10 +144,10 @@ VALUEの実際の構造は うかわかるわけです(ポインタのLSBが立っていないことを仮定して いる). -ですから,FIXNUM以外のrubyのオブジェクトの構造体は単にVALUE +ですから,FIXNUM以外のRubyのオブジェクトの構造体は単にVALUE にキャストするだけでVALUEに変換出来ます.ただし,任意の構造 体がVALUEにキャスト出来るわけではありません.キャストするの -はrubyの知っている構造体(ruby.hで定義されているstruct RXxxx +はRubyの知っている構造体(ruby.hで定義されているstruct RXxxx のもの)だけです. FIXNUMに関しては変換マクロを経由する必要があります.Cの整数 @@ -160,11 +160,11 @@ FIXNUMに関しては変換マクロを経由する必要があります.Cの整数 INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換 してくれます(が,少し遅い). -1.5 rubyのデータを操作する +1.5 Rubyのデータを操作する -先程も述べた通り,rubyの構造体をアクセスする時に内容の更新を -行うことは勧められません.で,rubyのデータを操作する時には -rubyが用意している関数を用いてください. +先程も述べた通り,Rubyの構造体をアクセスする時に内容の更新を +行うことは勧められません.で,Rubyのデータを操作する時には +Rubyが用意している関数を用いてください. ここではもっとも使われるであろう文字列と配列の生成/操作を行 い関数をあげます(全部ではないです). @@ -173,16 +173,16 @@ rubyが用意している関数を用いてください. str_new(char *ptr, int len) - 新しいrubyの文字列を生成する. + 新しいRubyの文字列を生成する. str_new2(char *ptr) - Cの文字列からrubyの文字列を生成する.この関数の機能は + Cの文字列からRubyの文字列を生成する.この関数の機能は str_new(ptr, strlen(ptr))と同等である. str_cat(VALUE str, char *ptr, int len) - rubyの文字列strにlenバイトの文字列ptrを追加する. + Rubyの文字列strにlenバイトの文字列ptrを追加する. 配列に対する関数 @@ -212,17 +212,17 @@ rubyが用意している関数を用いてください. Arrayの同名のメソッドと同じ働きをする関数.第1引数は必ず 配列でなければならない. -2.rubyの機能を使う +2.Rubyの機能を使う -原理的にrubyで書けることはCでも書けます.rubyそのものがCで記 +原理的にRubyで書けることはCでも書けます.RubyそのものがCで記 述されているんですから,当然といえば当然なんですけど.ここで -はrubyの拡張に使うことが多いだろうと予測される機能を中心に紹 +はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹 介します. -2.1 rubyに機能を追加する +2.1 Rubyに機能を追加する -rubyで提供されている関数を使えばrubyインタプリタに新しい機能 -を追加することができます.rubyでは以下の機能を追加する関数が +Rubyで提供されている関数を使えばRubyインタプリタに新しい機能 +を追加することができます.Rubyでは以下の機能を追加する関数が 提供されています. * クラス,モジュール @@ -260,7 +260,7 @@ rubyで提供されている関数を使えばrubyインタプリタに新しい機能 念のため説明すると「特異メソッド」とは,その特定のオブジェク -トに対してだけ有効なメソッドです.rubyではよくSmalltalkにお +トに対してだけ有効なメソッドです.RubyではよくSmalltalkにお けるクラスメソッドとして,クラスに対する特異メソッドが使われ ます. @@ -272,7 +272,7 @@ rubyで提供されている関数を使えばrubyインタプリタに新しい機能 argcが負の時は引数の数ではなく,形式を指定したことになります. argcが-1の時は引数を配列に入れて渡されます.argcが-2の時は引 -数はrubyの配列として渡されます. +数はRubyの配列として渡されます. メソッドを定義する関数はもう二つあります.ひとつはprivateメ ソッドを定義する関数で,引数はrb_define_method()と同じです. @@ -318,21 +318,21 @@ privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ 前者は特定のクラス/モジュールに属する定数を定義するもの,後 者はグローバルな定数を定義するものです. -2.2 rubyの機能をCから呼び出す +2.2 Rubyの機能をCから呼び出す -既に『1.5 rubyのデータを操作する』で一部紹介したような関数を -使えば,rubyの機能を実現している関数を直接呼び出すことが出来 +既に『1.5 Rubyのデータを操作する』で一部紹介したような関数を +使えば,Rubyの機能を実現している関数を直接呼び出すことが出来 ます. # このような関数の一覧表はいまのところありません.ソースを見 # るしかないですね. -それ以外にもrubyの機能を呼び出す方法はいくつかあります. +それ以外にもRubyの機能を呼び出す方法はいくつかあります. -2.2.1 rubyのプログラムをevalする +2.2.1 Rubyのプログラムをevalする -Cからrubyの機能を呼び出すもっとも簡単な方法として,文字列で -与えられたrubyのプログラムを評価する関数があります. +CからRubyの機能を呼び出すもっとも簡単な方法として,文字列で +与えられたRubyのプログラムを評価する関数があります. VALUE rb_eval_string(char *str) @@ -341,11 +341,11 @@ Cからrubyの機能を呼び出すもっとも簡単な方法として,文字列で 2.2.2 IDまたはシンボル -Cから文字列を経由せずにrubyのメソッドを呼び出すこともできま -す.その前に,rubyインタプリタ内でメソッドや変数名を指定する +Cから文字列を経由せずにRubyのメソッドを呼び出すこともできま +す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する 時に使われているIDについて説明しておきましょう. -IDとは変数名,メソッド名を表す整数です.rubyの中では +IDとは変数名,メソッド名を表す整数です.Rubyの中では :識別子 @@ -354,14 +354,14 @@ IDとは変数名,メソッド名を表す整数です.rubyの中では rb_intern(char *name) を使います.また一文字の演算子はその文字コードがそのままシン -ボルになっています.rubyから引数として与えられたシンボル(ま +ボルになっています.Rubyから引数として与えられたシンボル(ま たは文字列)をIDに変換するには以下の関数を使います. rb_to_id(VALUE symbol) -2.2.3 Cからrubyのメソッドを呼び出す +2.2.3 CからRubyのメソッドを呼び出す -Cから文字列を経由せずにrubyのメソッドを呼び出すためには以下 +Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下 の関数を使います. VALUE rb_funcall(VALUE recv, ID mid, int argc, ...) @@ -372,7 +372,7 @@ Cから文字列を経由せずにrubyのメソッドを呼び出すためには以下 VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) VALUE rb_apply(VALUE recv, ID mid, VALUE args) -applyには引数としてrubyの配列を与えます. +applyには引数としてRubyの配列を与えます. 2.2.4 変数/定数を参照/更新する @@ -395,13 +395,13 @@ idはrb_intern()で得られるものを使ってください. クラス定数を新しく定義するためには『2.1.3 定数定義』で紹介さ れている関数を使ってください. -3.rubyとCとの情報共有 +3.RubyとCとの情報共有 -C言語とrubyの間で情報を共有する方法について解説します. +C言語とRubyの間で情報を共有する方法について解説します. -3.1 Cから参照できるrubyの定数 +3.1 Cから参照できるRubyの定数 -以下のrubyの定数はCのレベルから参照できる. +以下のRubyの定数はCのレベルから参照できる. TRUE FALSE @@ -412,19 +412,19 @@ C言語とrubyの間で情報を共有する方法について解説します. C言語から見た「nil」. -3.2 Cとrubyで共有される大域変数 +3.2 CとRubyで共有される大域変数 -Cとrubyで大域変数を使って情報を共有できます.共有できる大域 +CとRubyで大域変数を使って情報を共有できます.共有できる大域 変数にはいくつかの種類があります.そのなかでもっとも良く使わ れると思われるのはrb_define_variable()です. void rb_define_variable(char *name, VALUE *var) -この関数はrubyとCとで共有する大域変数を定義します.変数名が +この関数はRubyとCとで共有する大域変数を定義します.変数名が `$'で始まらない時には自動的に追加されます.この変数の値を変 -更すると自動的にrubyの対応する変数の値も変わります. +更すると自動的にRubyの対応する変数の値も変わります. -またruby側からは更新できない変数もあります.このread onlyの +またRuby側からは更新できない変数もあります.このread onlyの 変数は以下の関数で定義します. void rb_define_readonly_variable(char *name, VALUE *var) @@ -443,13 +443,13 @@ setterに0を指定します. # getterもsetterも0ならばrb_define_variable()と同じになる. -それから,Cの関数によって実現されるrubyの大域変数を定義する +それから,Cの関数によって実現されるRubyの大域変数を定義する 関数があります. void rb_define_virtual_variable(char *name, VALUE (*getter)(), VALUE (*setter)()) -この関数によって定義されたrubyの大域変数が参照された時には +この関数によって定義されたRubyの大域変数が参照された時には getterが,変数に値がセットされた時にはsetterが呼ばれます. getterとsetterの仕様は以下の通りです. @@ -457,14 +457,14 @@ getterとsetterの仕様は以下の通りです. (*getter)(ID id, void *data, struct global_entry* entry); (*setter)(VALUE val, ID id, void *data, struct global_entry* entry); -3.3 Cのデータをrubyオブジェクトにする +3.3 CのデータをRubyオブジェクトにする -Cの世界で定義されたデータ(構造体)をrubyのオブジェクトとして +Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして 取り扱いたい場合がありえます.このような場合には,Dataという -rubyオブジェクトにCの構造体(へのポインタ)をくるむことでruby +RubyオブジェクトにCの構造体(へのポインタ)をくるむことでRuby オブジェクトとして取り扱えるようになります. -Dataオブジェクトを生成して構造体をrubyオブジェクトにカプセル +Dataオブジェクトを生成して構造体をRubyオブジェクトにカプセル 化するためには,以下のマクロを使います. Data_Wrap_Struct(class,mark,free,ptr) @@ -472,7 +472,7 @@ Dataオブジェクトを生成して構造体をrubyオブジェクトにカプセル このマクロの戻り値は生成されたDataオブジェクトです. classはこのDataオブジェクトのクラスです.ptrはカプセル化する -Cの構造体へのポインタです.markはこの構造体がrubyのオブジェ +Cの構造体へのポインタです.markはこの構造体がRubyのオブジェ クトへの参照がある時に使う関数です.そのような参照を含まない 時には0を指定します. @@ -505,16 +505,16 @@ Cの構造体へのポインタは変数svalに代入されます. 4.例題 - dbmパッケージを作る ここまでの説明でとりあえず拡張モジュールは作れるはずです. -rubyのextディレクトリにすでに含まれているdbmモジュールを例に +Rubyのextディレクトリにすでに含まれているdbmモジュールを例に して段階的に説明します. (1) ディレクトリを作る % mkdir ext/dbm -ruby 1.1からは任意のディレクトリでダイナミックライブラリを作 -ることができるようになりました.rubyに静的にリンクする場合に -はrubyを展開したディレクトリの下,extディレクトリの中に拡張 +Ruby 1.1からは任意のディレクトリでダイナミックライブラリを作 +ることができるようになりました.Rubyに静的にリンクする場合に +はRubyを展開したディレクトリの下,extディレクトリの中に拡張 モジュール用のディレクトリを作る必要があります.名前は適当に 選んで構いません. @@ -548,7 +548,7 @@ MANIFESTというファイルは,静的リンクのmakeの時にディレクトリ ル生成時に中間的に生成される「モジュール名.o」というファイル とが衝突するからです. -rubyは拡張モジュールをロードする時に「Init_モジュール名」と +Rubyは拡張モジュールをロードする時に「Init_モジュール名」と いう関数を自動的に実行します.dbmモジュールの場合「Init_dbm」 です.この関数の中でクラス,モジュール,メソッド,定数などの 定義を行います.dbm.cから一部引用します. @@ -576,7 +576,7 @@ Init_dbm() -- DBMモジュールはdbmのデータと対応するオブジェクトになるはずで -すから,Cの世界のdbmをrubyの世界に取り込む必要があります. +すから,Cの世界のdbmをRubyの世界に取り込む必要があります. dbm.cではData_Make_Structを以下のように使っています. @@ -626,7 +626,7 @@ fdbm_delete(obj, keystr) 引数の数が固定のタイプは第1引数がself,第2引数以降がメソッド の引数となります. -引数の数が不定のものはCの配列で受けるものとrubyの配列で受け +引数の数が不定のものはCの配列で受けるものとRubyの配列で受け るものとがあります.dbmモジュールの中で,Cの配列で受けるもの はDBMのクラスメソッドであるopen()です.これを実装している関 数fdbm_s_open()はこうなっています. @@ -660,7 +660,7 @@ fdbm_s_open(argc, argv, class) で,2つまで許されるという意味になります.省略されている時の 変数の値はnil(C言語のレベルではQnil)になります. -rubyの配列で引数を受け取るものはindexesがあります.実装はこ +Rubyの配列で引数を受け取るものはindexesがあります.実装はこ うです. -- @@ -673,14 +673,14 @@ fdbm_indexes(obj, args) } -- -第1引数はself,第2引数はrubyの配列です.ここではキャストを減 +第1引数はself,第2引数はRubyの配列です.ここではキャストを減 らすため struct RArray* で受けていますが,VALUEでも同じこと です. ** 注意事項 -rubyと共有はしないがrubyのオブジェクトを格納する可能性のある -Cの大域変数は以下の関数を使ってrubyインタプリタに変数の存在 +Rubyと共有はしないがRubyのオブジェクトを格納する可能性のある +Cの大域変数は以下の関数を使ってRubyインタプリタに変数の存在 を教えてあげてください.でないとGCでトラブルを起こします. void rb_global_variable(VALUE *var) @@ -689,7 +689,7 @@ Cの大域変数は以下の関数を使ってrubyインタプリタに変数の存在 Makefileを作る場合の雛型になるextconf.rbというファイルを作り ます.extconf.rbはモジュールのコンパイルに必要な条件のチェッ -クなどを行うことが目的です.extconf.rbの中では以下のruby関数 +クなどを行うことが目的です.extconf.rbの中では以下のRuby関数 を使うことが出来ます. have_library(lib, func): ライブラリの存在チェック @@ -706,7 +706,7 @@ Makefileを作る場合の雛型になるextconf.rbというファイルを作り ンパイルしない時にはcreate_makefileを呼ばなければMakefileは 生成されず,コンパイルも行われません. -モジュールがruby 1.1専用である場合には +モジュールがRuby 1.1専用である場合には require 'mkmf' @@ -745,7 +745,7 @@ Makefileを実際に生成するためには としてください. -ディレクトリをext以下に用意した場合にはruby全体のmakeの時に +ディレクトリをext以下に用意した場合にはRuby全体のmakeの時に 自動的にMakefileが生成されますので,このステップは不要です. (9) makeする @@ -753,15 +753,15 @@ Makefileを実際に生成するためには 動的リンクライブラリを生成する場合にはその場でmakeしてくださ い.必要であれば make install でインストールされます. -ext以下にディレクトリを用意した場合は,rubyのディレクトリで +ext以下にディレクトリを用意した場合は,Rubyのディレクトリで makeを実行するとMakefileを生成からmake,必要によってはそのモ -ジュールのrubyへのリンクまで自動的に実行してくれます. +ジュールのRubyへのリンクまで自動的に実行してくれます. extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま -たrubyディレクトリでmakeしてください. +たRubyディレクトリでmakeしてください. -動的リンクライブラリはmake installでrubyライブラリのディレク -トリの下にコピーされます.もしモジュールと協調して使うrubyで -記述されたプログラムがあり,rubyライブラリに置きたい場合には, +動的リンクライブラリはmake installでRubyライブラリのディレク +トリの下にコピーされます.もしモジュールと協調して使うRubyで +記述されたプログラムがあり,Rubyライブラリに置きたい場合には, 拡張モジュール用のディレクトリの下に lib というディレクトリ を作り,そこに 拡張子 .rb のファイルを置いておけば同時にイン ストールされます. @@ -775,17 +775,17 @@ extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま (11) できあがり 後はこっそり使うなり,広く公開するなり,売るなり,ご自由にお -使いください.rubyの作者は拡張モジュールに関して一切の権利を +使いください.Rubyの作者は拡張モジュールに関して一切の権利を 主張しません. -Appendix A. rubyのソースコードの分類 +Appendix A. Rubyのソースコードの分類 -rubyのソースはいくつかに分類することが出来ます.このうちクラ +Rubyのソースはいくつかに分類することが出来ます.このうちクラ スライブラリの部分は基本的に拡張モジュールと同じ作り方になっ ています.これらのソースは今までの説明でほとんど理解できると 思います. -ruby言語のコア +Ruby言語のコア class.c error.c @@ -804,7 +804,7 @@ ruby言語のコア st.c util.c -rubyコマンドの実装 +Rubyコマンドの実装 dmyext.c inits.c @@ -838,13 +838,13 @@ rubyコマンドの実装 Appendix B. 拡張用関数リファレンス -C言語からrubyの機能を利用するAPIは以下の通りである. +C言語からRubyの機能を利用するAPIは以下の通りである. ** 型 VALUE -rubyオブジェクトを表現する型.必要に応じてキャストして用いる. +Rubyオブジェクトを表現する型.必要に応じてキャストして用いる. 組み込み型を表現するCの型はruby.hに記述してあるRで始まる構造 体である.VALUE型をこれらにキャストするためにRで始まる構造体 名を全て大文字にした名前のマクロが用意されている. @@ -867,9 +867,9 @@ rubyオブジェクトを表現する型.必要に応じてキャストして用いる. Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval) -Cの任意のポインタをカプセル化したrubyオブジェクトを返す.こ -のポインタがrubyからアクセスされなくなった時,freeで指定した -関数が呼ばれる.また,このポインタの指すデータが他のrubyオブ +Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ +のポインタがRubyからアクセスされなくなった時,freeで指定した +関数が呼ばれる.また,このポインタの指すデータが他のRubyオブ ジェクトを指している場合,markに指定する関数でマークする必要 がある. @@ -905,20 +905,20 @@ dataからtype型のポインタを取り出し変数svalに代入するマクロ. VALUE rb_define_class(char *name, VALUE super) -superのサブクラスとして新しいrubyクラスを定義する. +superのサブクラスとして新しいRubyクラスを定義する. VALUE rb_define_class_under(VALUE module, char *name, VALUE super) -superのサブクラスとして新しいrubyクラスを定義し,moduleの定 +superのサブクラスとして新しいRubyクラスを定義し,moduleの定 数として定義する. VALUE rb_define_module(char *name) -新しいrubyモジュールを定義する. +新しいRubyモジュールを定義する. VALUE rb_define_module_under(VALUE module, char *name, VALUE super) -新しいrubyモジュールを定義し,moduleの定数として定義する. +新しいRubyモジュールを定義し,moduleの定数として定義する. void rb_include_module(VALUE class, VALUE module) @@ -933,20 +933,20 @@ superのサブクラスとして新しいrubyクラスを定義し,moduleの定 void rb_define_variable(char *name, VALUE *var) -rubyとCとで共有するグローバル変数を定義する.変数名が`$'で始 -まらない時には自動的に追加される.nameとしてrubyの識別子とし -て許されない文字(例えば` ')を含む場合にはrubyプログラムから +RubyとCとで共有するグローバル変数を定義する.変数名が`$'で始 +まらない時には自動的に追加される.nameとしてRubyの識別子とし +て許されない文字(例えば` ')を含む場合にはRubyプログラムから は見えなくなる. void rb_define_readonly_variable(char *name, VALUE *var) -rubyとCとで共有するread onlyのグローバル変数を定義する.read +RubyとCとで共有するread onlyのグローバル変数を定義する.read onlyであること以外はrb_define_variable()と同じ. void rb_define_virtual_variable(char *name, VALUE (*getter)(), VALUE (*setter)()) -関数によって実現されるruby変数を定義する.変数が参照された時 +関数によって実現されるRuby変数を定義する.変数が参照された時 にはgetterが,変数に値がセットされた時にはsetterが呼ばれる. void rb_define_hooked_variable(char *name, VALUE *var, @@ -959,7 +959,7 @@ onlyであること以外はrb_define_variable()と同じ. void rb_global_variable(VALUE *var) -GCのため,rubyプログラムからはアクセスされないが, rubyオブジェ +GCのため,Rubyプログラムからはアクセスされないが, Rubyオブジェ クトを含む大域変数をマークする. ** クラス定数 @@ -983,7 +983,7 @@ GCのため,rubyプログラムからはアクセスされないが, rubyオブジェ メソッドを定義する.argcはselfを除く引数の数.argcが-1の時, 関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2引 数とする形式で与えられる(第3引数はself).argcが-2の時, 第1引 -数がself, 第2引数がargs(argsは引数を含むrubyの配列)という形 +数がself, 第2引数がargs(argsは引数を含むRubyの配列)という形 式で与えられる. rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc) @@ -1004,7 +1004,7 @@ argc,argv形式で与えられた引数を分解する.fmtは必須引数の数, 数に対応する引数が与えられていない場合は変数にQnilが代入され る. -** rubyメソッド呼び出し +** Rubyメソッド呼び出し VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) @@ -1016,7 +1016,7 @@ argc,argv形式で与えられた引数を分解する.fmtは必須引数の数, VALUE rb_eval_string(char *str) -文字列をrubyとスクリプトしてコンパイル・実行する. +文字列をRubyとスクリプトしてコンパイル・実行する. ID rb_intern(char *name) @@ -1036,7 +1036,7 @@ classの名前を返す(デバッグ用).classが名前を持たない時には, VALUE rb_iv_get(VALUE obj, char *name) objのインスタンス変数の値を得る.`@'で始まらないインスタンス -変数は rubyプログラムからアクセスできない「隠れた」インスタ +変数は Rubyプログラムからアクセスできない「隠れた」インスタ ンス変数になる.定数は大文字の名前を持つクラス(またはモジュー ル)のインスタンス変数として実装されている. @@ -1095,22 +1095,22 @@ exceptionで指定した例外を発生させる.fmt以下の引数はprintf()と同じ. 況の時呼ぶ.インタープリタはコアダンプし直ちに終了する.例外 処理は一切行なわれない. -** rubyの初期化・実行 +** Rubyの初期化・実行 -rubyをアプリケーションに埋め込む場合には以下のインタフェース +Rubyをアプリケーションに埋め込む場合には以下のインタフェース を使う.通常の拡張モジュールには必要ない. void ruby_init(int argc, char **argv, char **envp) -rubyインタプリタの初期化を行なう. +Rubyインタプリタの初期化を行なう. void ruby_run() -rubyインタプリタを実行する. +Rubyインタプリタを実行する. void ruby_script(char *name) -rubyのスクリプト名($0)を設定する. +Rubyのスクリプト名($0)を設定する. Appendix B. extconf.rbで使える関数たち @@ -5,7 +5,7 @@ Rubyは最初から純粋なオブジェクト指向言語として設計されていま すから,オブジェクト指向プログラミングを手軽に行う事が出来ま す.もちろん通常の手続き型のプログラミングも可能です. -Rubyはテキスト処理関係の能力などに優れ,perlと同じくらい強力 +Rubyはテキスト処理関係の能力などに優れ,Perlと同じくらい強力 です.さらにシンプルな文法と,例外処理やイテレータなどの機構 によって,より分かりやすいプログラミングが出来ます. @@ -81,7 +81,7 @@ ary_new() return ary_new2(ARY_DEFAULT_SIZE); } -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES #include <stdarg.h> #define va_init_list(a,b) va_start(a,b) #else @@ -90,7 +90,7 @@ ary_new() #endif VALUE -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES ary_new3(int n, ...) #else ary_new3(n, va_alist) @@ -565,7 +565,7 @@ rb_define_attr(klass, name, read, write) rb_attr(klass, rb_intern(name), read, write, FALSE); } -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES #include <stdarg.h> #define va_init_list(a,b) va_start(a,b) #else @@ -575,7 +575,7 @@ rb_define_attr(klass, name, read, write) #include <ctype.h> int -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES rb_scan_args(int argc, VALUE *argv, char *fmt, ...) #else rb_scan_args(argc, argv, fmt, va_alist) @@ -1,4 +1,10 @@ #define THREAD 1 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_VOIDP 4 +#define HAVE_PROTOTYPES 1 +#define HAVE_STDARG_PROTOTYPES 1 +#define HAVE_ATTR_NORETURN 1 #define HAVE_DIRENT_H 1 #define HAVE_UNISTD_H 1 #define HAVE_LIMITS_H 1 @@ -1183,6 +1183,233 @@ EOF fi +echo $ac_n "checking size of int""... $ac_c" 1>&6 +echo "configure:1188: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1196 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_INT $ac_cv_sizeof_int +EOF + + +echo $ac_n "checking size of long""... $ac_c" 1>&6 +echo "configure:1227: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1235 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long)); + exit(0); +} +EOF +if { (eval echo configure:1246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG $ac_cv_sizeof_long +EOF + + +echo $ac_n "checking size of void*""... $ac_c" 1>&6 +echo "configure:1266: checking size of void*" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1274 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(void*)); + exit(0); +} +EOF +if { (eval echo configure:1285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_voidp=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_voidp=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_voidp" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_VOIDP $ac_cv_sizeof_voidp +EOF + + + +echo $ac_n "checking for prototypes""... $ac_c" 1>&6 +echo "configure:1306: checking for prototypes" >&5 +if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1311 "configure" +#include "confdefs.h" +int foo(int x) { return 0; } +int main() { +return foo(10); +; return 0; } +EOF +if { (eval echo configure:1318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_have_prototypes=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_have_prototypes=no +fi +rm -f conftest* +fi + +echo "$ac_t""$rb_cv_have_prototypes" 1>&6 +if test "$rb_cv_have_prototypes" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PROTOTYPES 1 +EOF + +fi + +echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6 +echo "configure:1339: checking for variable length prototypes and stdarg.h" >&5 +if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1344 "configure" +#include "confdefs.h" + +#include <stdarg.h> +int foo(int x, ...) { + va_list va; + va_start(va, x); + va_arg(va, int); + va_arg(va, char *); + va_arg(va, double); + return 0; +} + +int main() { +return foo(10, "", 3.14); +; return 0; } +EOF +if { (eval echo configure:1361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_stdarg=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_stdarg=no +fi +rm -f conftest* +fi + +echo "$ac_t""$rb_cv_stdarg" 1>&6 +if test "$rb_cv_stdarg" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STDARG_PROTOTYPES 1 +EOF + +fi + +echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6 +echo "configure:1382: checking for gcc attribute noreturn" >&5 +if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1387 "configure" +#include "confdefs.h" +void exit(int x) __attribute__ ((noreturn)); +int main() { + +; return 0; } +EOF +if { (eval echo configure:1394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_have_attr_noreturn=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_have_attr_noreturn=no +fi +rm -f conftest* +fi + +echo "$ac_t""$rb_cv_have_attr_noreturn" 1>&6 +if test "$rb_cv_have_attr_noreturn" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ATTR_NORETURN 1 +EOF + +fi + case "$host_os" in nextstep*) ;; human*) ;; @@ -1190,7 +1417,7 @@ beos*) ;; *) LIBS="-lm $LIBS";; esac echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1194: checking for crypt in -lcrypt" >&5 +echo "configure:1421: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1198,7 +1425,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 1202 "configure" +#line 1429 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1209,7 +1436,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1237,7 +1464,7 @@ else fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:1241: checking for dlopen in -ldl" >&5 +echo "configure:1468: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1245,7 +1472,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 1249 "configure" +#line 1476 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1256,7 +1483,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1284,7 +1511,7 @@ else fi # Dynamic linking for SunOS/Solaris and SYSV echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:1288: checking for shl_load in -ldld" >&5 +echo "configure:1515: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1292,7 +1519,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <<EOF -#line 1296 "configure" +#line 1523 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1303,7 +1530,7 @@ int main() { shl_load() ; return 0; } EOF -if { (eval echo configure:1307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1336,12 +1563,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1340: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1567: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1345 "configure" +#line 1572 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -1349,7 +1576,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1374,7 +1601,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1378: checking for opendir in -ldir" >&5 +echo "configure:1605: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1382,7 +1609,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 1386 "configure" +#line 1613 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1393,7 +1620,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1415,7 +1642,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1419: checking for opendir in -lx" >&5 +echo "configure:1646: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1423,7 +1650,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 1427 "configure" +#line 1654 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1434,7 +1661,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1457,12 +1684,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1461: checking for ANSI C header files" >&5 +echo "configure:1688: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1466 "configure" +#line 1693 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1470,7 +1697,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1487,7 +1714,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1491 "configure" +#line 1718 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1505,7 +1732,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1509 "configure" +#line 1736 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1526,7 +1753,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1530 "configure" +#line 1757 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1537,7 +1764,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1562,22 +1789,21 @@ fi for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ sys/select.h sys/time.h sys/times.h sys/param.h sys/wait.h\ - syscall.h a.out.h string.h utime.h memory.h\ - varargs.h stdarg.h + syscall.h a.out.h string.h utime.h memory.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1571: checking for $ac_hdr" >&5 +echo "configure:1797: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1576 "configure" +#line 1802 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1605,12 +1831,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1609: checking for uid_t in sys/types.h" >&5 +echo "configure:1835: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1614 "configure" +#line 1840 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1639,12 +1865,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1643: checking for size_t" >&5 +echo "configure:1869: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1648 "configure" +#line 1874 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1672,12 +1898,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:1676: checking for st_blksize in struct stat" >&5 +echo "configure:1902: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1681 "configure" +#line 1907 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1685,7 +1911,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:1689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -1707,12 +1933,12 @@ fi save_LIBOJBS="$LIBOBJS" echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:1711: checking for st_blocks in struct stat" >&5 +echo "configure:1937: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1716 "configure" +#line 1942 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1720,7 +1946,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:1724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -1744,12 +1970,12 @@ fi LIBOBJS="$save_LIBOBJS" echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:1748: checking for st_rdev in struct stat" >&5 +echo "configure:1974: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1753 "configure" +#line 1979 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1757,7 +1983,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -1778,126 +2004,8 @@ EOF fi -echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1783: checking size of int" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 1791 "configure" -#include "confdefs.h" -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(int)); - exit(0); -} -EOF -if { (eval echo configure:1802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_int=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >> confdefs.h <<EOF -#define SIZEOF_INT $ac_cv_sizeof_int -EOF - - -echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1822: checking size of long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 1830 "configure" -#include "confdefs.h" -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long)); - exit(0); -} -EOF -if { (eval echo configure:1841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <<EOF -#define SIZEOF_LONG $ac_cv_sizeof_long -EOF - - -echo $ac_n "checking size of void*""... $ac_c" 1>&6 -echo "configure:1861: checking size of void*" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 1869 "configure" -#include "confdefs.h" -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(void*)); - exit(0); -} -EOF -if { (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_voidp=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_voidp=0 -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_sizeof_voidp" 1>&6 -cat >> confdefs.h <<EOF -#define SIZEOF_VOIDP $ac_cv_sizeof_voidp -EOF - - - echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:1901: checking type of array argument to getgroups" >&5 +echo "configure:2009: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1905,7 +2013,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 1909 "configure" +#line 2017 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -1930,7 +2038,7 @@ main() } EOF -if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -1944,7 +2052,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 1948 "configure" +#line 2056 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -1968,12 +2076,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1972: checking return type of signal handlers" >&5 +echo "configure:2080: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1977 "configure" +#line 2085 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1990,7 +2098,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2011,19 +2119,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2015: checking for working alloca.h" >&5 +echo "configure:2123: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2020 "configure" +#line 2128 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2044,12 +2152,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2048: checking for alloca" >&5 +echo "configure:2156: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2053 "configure" +#line 2161 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2072,7 +2180,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2104,12 +2212,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2108: checking whether alloca needs Cray hooks" >&5 +echo "configure:2216: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2113 "configure" +#line 2221 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2134,12 +2242,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2138: checking for $ac_func" >&5 +echo "configure:2246: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2143 "configure" +#line 2251 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2162,7 +2270,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2189,7 +2297,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2193: checking stack direction for C alloca" >&5 +echo "configure:2301: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2197,7 +2305,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2201 "configure" +#line 2309 "configure" #include "confdefs.h" find_stack_direction () { @@ -2216,7 +2324,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2238,12 +2346,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2242: checking for pid_t" >&5 +echo "configure:2350: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2247 "configure" +#line 2355 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2272,17 +2380,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2276: checking for vfork.h" >&5 +echo "configure:2384: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2281 "configure" +#line 2389 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2394: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2307,18 +2415,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2311: checking for working vfork" >&5 +echo "configure:2419: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2317: checking for vfork" >&5 +echo "configure:2425: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2322 "configure" +#line 2430 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2341,7 +2449,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2362,7 +2470,7 @@ fi else cat > conftest.$ac_ext <<EOF -#line 2366 "configure" +#line 2474 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2457,7 +2565,7 @@ main() { } } EOF -if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2480,7 +2588,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2484: checking for 8-bit clean memcmp" >&5 +echo "configure:2592: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2488,7 +2596,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 2492 "configure" +#line 2600 "configure" #include "confdefs.h" main() @@ -2498,7 +2606,7 @@ main() } EOF -if { (eval echo configure:2502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2519,12 +2627,12 @@ for ac_func in dup2 setenv memmove mkdir strcasecmp strerror strftime\ strchr strstr strtoul strdup crypt flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2523: checking for $ac_func" >&5 +echo "configure:2631: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2528 "configure" +#line 2636 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2547,7 +2655,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2580,12 +2688,12 @@ for ac_func in fmod killpg random wait4 waitpid syscall getcwd\ dlopen sigprocmask sigaction _setjmp setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2584: checking for $ac_func" >&5 +echo "configure:2692: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2589 "configure" +#line 2697 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2608,7 +2716,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2634,12 +2742,12 @@ done if test "$ac_cv_func_strftime" = no; then echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2638: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2746: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2643 "configure" +#line 2751 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -2647,7 +2755,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2668,12 +2776,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2672: checking for tm_zone in struct tm" >&5 +echo "configure:2780: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2677 "configure" +#line 2785 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -2681,7 +2789,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2701,12 +2809,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2705: checking for tzname" >&5 +echo "configure:2813: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2710 "configure" +#line 2818 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -2716,7 +2824,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2738,14 +2846,14 @@ EOF fi cat > conftest.$ac_ext <<EOF -#line 2742 "configure" +#line 2850 "configure" #include "confdefs.h" int main() { extern int daylight; int i = daylight; ; return 0; } EOF -if { (eval echo configure:2749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_DAYLIGHT 1 @@ -2765,7 +2873,7 @@ EOF else echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 -echo "configure:2769: checking for BSD signal semantics" >&5 +echo "configure:2877: checking for BSD signal semantics" >&5 if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2773,7 +2881,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2777 "configure" +#line 2885 "configure" #include "confdefs.h" #include <stdio.h> @@ -2795,7 +2903,7 @@ main() } EOF -if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_bsd_signal=yes else @@ -2829,19 +2937,19 @@ EOF else echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6 -echo "configure:2833: checking whether getpgrp() has arg" >&5 +echo "configure:2941: checking whether getpgrp() has arg" >&5 if eval "test \"`echo '$''{'rb_cv_bsdgetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2838 "configure" +#line 2946 "configure" #include "confdefs.h" #include <unistd.h> int main() { getpgrp(0); ; return 0; } EOF -if { (eval echo configure:2845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdgetpgrp=yes else @@ -2862,19 +2970,19 @@ EOF fi echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6 -echo "configure:2866: checking whether setpgrp() has args" >&5 +echo "configure:2974: checking whether setpgrp() has args" >&5 if eval "test \"`echo '$''{'rb_cv_bsdsetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2871 "configure" +#line 2979 "configure" #include "confdefs.h" #include <unistd.h> int main() { setpgrp(1, 1); ; return 0; } EOF -if { (eval echo configure:2878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdsetpgrp=yes else @@ -2896,14 +3004,14 @@ EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:2900: checking whether byte ordering is bigendian" >&5 +echo "configure:3008: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 2907 "configure" +#line 3015 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -2914,11 +3022,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3026: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 2922 "configure" +#line 3030 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -2929,7 +3037,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -2949,7 +3057,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2953 "configure" +#line 3061 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -2962,7 +3070,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:2966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -2986,14 +3094,14 @@ EOF fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:2990: checking whether char is unsigned" >&5 +echo "configure:3098: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <<EOF -#line 2997 "configure" +#line 3105 "configure" #include "confdefs.h" #ifdef __CHAR_UNSIGNED__ yes @@ -3015,7 +3123,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3019 "configure" +#line 3127 "configure" #include "confdefs.h" /* volatile prevents gcc2 from optimizing the test away on sparcs. */ #if !defined(__STDC__) || __STDC__ != 1 @@ -3025,7 +3133,7 @@ main() { volatile char c = 255; exit(c < 0); } EOF -if { (eval echo configure:3029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -3050,19 +3158,19 @@ fi echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 -echo "configure:3054: checking count field in FILE structures" >&5 +echo "configure:3162: checking count field in FILE structures" >&5 if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3059 "configure" +#line 3167 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_cnt = 0; ; return 0; } EOF -if { (eval echo configure:3066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_cnt" else @@ -3072,14 +3180,14 @@ fi rm -f conftest* if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3076 "configure" +#line 3184 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->__cnt = 0; ; return 0; } EOF -if { (eval echo configure:3083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="__cnt" else @@ -3090,14 +3198,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3094 "configure" +#line 3202 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_r = 0; ; return 0; } EOF -if { (eval echo configure:3101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_r" else @@ -3108,14 +3216,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3112 "configure" +#line 3220 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->readCount = 0; ; return 0; } EOF -if { (eval echo configure:3119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="readCount" else @@ -3140,9 +3248,9 @@ fi if test "$ac_cv_func_getpwent" = yes; then echo $ac_n "checking struct passwd""... $ac_c" 1>&6 -echo "configure:3144: checking struct passwd" >&5 +echo "configure:3252: checking struct passwd" >&5 cat > conftest.$ac_ext <<EOF -#line 3146 "configure" +#line 3254 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3157,7 +3265,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3161 "configure" +#line 3269 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3172,7 +3280,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3176 "configure" +#line 3284 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3187,7 +3295,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3191 "configure" +#line 3299 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3202,7 +3310,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3206 "configure" +#line 3314 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3217,7 +3325,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3221 "configure" +#line 3329 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3232,7 +3340,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3236 "configure" +#line 3344 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3265,7 +3373,7 @@ fi case "$host_os" in linux*) echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 -echo "configure:3269: checking whether ELF binaries are produced" >&5 +echo "configure:3377: checking whether ELF binaries are produced" >&5 if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3273,7 +3381,7 @@ else : else cat > conftest.$ac_ext <<EOF -#line 3277 "configure" +#line 3385 "configure" #include "confdefs.h" /* Test for whether ELF binaries are produced */ @@ -3293,7 +3401,7 @@ main() { } EOF -if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_linux_elf=yes else @@ -3323,7 +3431,7 @@ STATIC= if test "$with_dln_a_out" != yes; then rb_cv_dlopen=unknown echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 -echo "configure:3327: checking whether OS depend dynamic link works" >&5 +echo "configure:3435: checking whether OS depend dynamic link works" >&5 if test "$GCC" = yes; then case "$host_os" in nextstep*) ;; @@ -3384,13 +3492,13 @@ dln_a_out_works=no if test "$ac_cv_header_a_out_h" = yes; then if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 -echo "configure:3388: checking whether matz's dln works" >&5 +echo "configure:3496: checking whether matz's dln works" >&5 cat confdefs.h > config.h if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3394 "configure" +#line 3502 "configure" #include "confdefs.h" #define USE_DLN_A_OUT @@ -3400,7 +3508,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -3483,7 +3591,7 @@ fi case "$host_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:3487: checking for _harderr in -lsignal" >&5 +echo "configure:3595: checking for _harderr in -lsignal" >&5 ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3491,7 +3599,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <<EOF -#line 3495 "configure" +#line 3603 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3502,7 +3610,7 @@ int main() { _harderr() ; return 0; } EOF -if { (eval echo configure:3506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3530,7 +3638,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:3534: checking for hmemset in -lhmem" >&5 +echo "configure:3642: checking for hmemset in -lhmem" >&5 ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3538,7 +3646,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <<EOF -#line 3542 "configure" +#line 3650 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3549,7 +3657,7 @@ int main() { hmemset() ; return 0; } EOF -if { (eval echo configure:3553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3579,12 +3687,12 @@ fi for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3583: checking for $ac_func" >&5 +echo "configure:3691: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3588 "configure" +#line 3696 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3607,7 +3715,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3632,7 +3740,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:3636: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:3744: checking whether PD libc _dtos18 fail to convert big number" >&5 if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3640,7 +3748,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3644 "configure" +#line 3752 "configure" #include "confdefs.h" #include <stdio.h> @@ -3652,7 +3760,7 @@ main () } EOF -if { (eval echo configure:3656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing__dtos18=yes else @@ -3674,7 +3782,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:3678: checking whether PD libc fconvert fail to round" >&5 +echo "configure:3786: checking whether PD libc fconvert fail to round" >&5 if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3682,7 +3790,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3686 "configure" +#line 3794 "configure" #include "confdefs.h" #include <stdio.h> @@ -3695,7 +3803,7 @@ main () } EOF -if { (eval echo configure:3699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing_fconvert=yes else diff --git a/configure.in b/configure.in index 84aabbe496..2665d083df 100644 --- a/configure.in +++ b/configure.in @@ -72,6 +72,50 @@ AC_PROG_MAKE_SET # checks for UNIX variants that set C preprocessor variables AC_MINIX +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(void*) + +AC_MSG_CHECKING(for prototypes) +AC_CACHE_VAL(rb_cv_have_prototypes, + [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], + rb_cv_have_prototypes=yes, + rb_cv_have_prototypes=no)]) +AC_MSG_RESULT($rb_cv_have_prototypes) +if test "$rb_cv_have_prototypes" = yes; then + AC_DEFINE(HAVE_PROTOTYPES) +fi + +AC_MSG_CHECKING(for variable length prototypes and stdarg.h) +AC_CACHE_VAL(rb_cv_stdarg, + [AC_TRY_COMPILE([ +#include <stdarg.h> +int foo(int x, ...) { + va_list va; + va_start(va, x); + va_arg(va, int); + va_arg(va, char *); + va_arg(va, double); + return 0; +} +], [return foo(10, "", 3.14);], + rb_cv_stdarg=yes, + rb_cv_stdarg=no)]) +AC_MSG_RESULT($rb_cv_stdarg) +if test "$rb_cv_stdarg" = yes; then + AC_DEFINE(HAVE_STDARG_PROTOTYPES) +fi + +AC_MSG_CHECKING(for gcc attribute noreturn) +AC_CACHE_VAL(rb_cv_have_attr_noreturn, + [AC_TRY_COMPILE([void exit(int x) __attribute__ ((noreturn));], [], + rb_cv_have_attr_noreturn=yes, + rb_cv_have_attr_noreturn=no)]) +AC_MSG_RESULT($rb_cv_have_attr_noreturn) +if test "$rb_cv_have_attr_noreturn" = yes; then + AC_DEFINE(HAVE_ATTR_NORETURN) +fi + dnl Checks for libraries. case "$host_os" in nextstep*) ;; @@ -88,8 +132,7 @@ AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ sys/select.h sys/time.h sys/times.h sys/param.h sys/wait.h\ - syscall.h a.out.h string.h utime.h memory.h\ - varargs.h stdarg.h) + syscall.h a.out.h string.h utime.h memory.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UID_T @@ -100,10 +143,6 @@ AC_STRUCT_ST_BLOCKS LIBOBJS="$save_LIBOBJS" AC_STRUCT_ST_RDEV -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(void*) - dnl Checks for library functions. AC_TYPE_GETGROUPS AC_TYPE_SIGNAL @@ -13,7 +13,7 @@ #include "ruby.h" #include "env.h" #include <stdio.h> -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES #include <stdarg.h> #define va_init_list(a,b) va_start(a,b) #else @@ -58,7 +58,7 @@ err_print(fmt, args) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Error(char *fmt, ...) #else Error(fmt, va_alist) @@ -75,7 +75,7 @@ Error(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Error_Append(char *fmt, ...) #else Error_Append(fmt, va_alist) @@ -93,7 +93,7 @@ Error_Append(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Warn(char *fmt, ...) #else Warn(fmt, va_alist) @@ -113,7 +113,7 @@ Warn(fmt, va_alist) /* Warning() reports only in verbose mode */ void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Warning(char *fmt, ...) #else Warning(fmt, va_alist) @@ -134,7 +134,7 @@ Warning(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Bug(char *fmt, ...) #else Bug(fmt, va_alist) @@ -182,10 +182,6 @@ static struct types { -1, 0, }; -#ifndef __STDC__ -extern void TypeError(); -#endif - void rb_check_type(x, t) VALUE x; @@ -537,7 +533,7 @@ Init_Exception() } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Raise(VALUE exc, char *fmt, ...) #else Raise(exc, fmt, va_alist) @@ -550,7 +546,7 @@ Raise(exc, fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES TypeError(char *fmt, ...) #else TypeError(fmt, va_alist) @@ -562,7 +558,7 @@ TypeError(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES ArgError(char *fmt, ...) #else ArgError(fmt, va_alist) @@ -574,7 +570,7 @@ ArgError(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES NameError(char *fmt, ...) #else NameError(fmt, va_alist) @@ -586,7 +582,7 @@ NameError(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES IndexError(char *fmt, ...) #else IndexError(fmt, va_alist) @@ -598,7 +594,7 @@ IndexError(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Fail(char *fmt, ...) #else Fail(fmt, va_alist) @@ -618,7 +614,7 @@ rb_notimplement() } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES LoadError(char *fmt, ...) #else LoadError(fmt, va_alist) @@ -630,7 +626,7 @@ LoadError(fmt, va_alist) } void -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES Fatal(char *fmt, ...) #else Fatal(fmt, va_alist) @@ -2684,6 +2684,7 @@ rb_iter_break() JUMP_TAG(TAG_BREAK); } +static void rb_longjmp _((int, VALUE)) NORETURN; static VALUE make_backtrace _((void)); static void @@ -3614,7 +3615,7 @@ f_send(argc, argv, recv) #endif VALUE -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES rb_funcall(VALUE recv, ID mid, int n, ...) #else rb_funcall(recv, mid, n, va_alist) diff --git a/ext/gtk/gtk.c b/ext/gtk/gtk.c index 1d0d241369..21079026fc 100644 --- a/ext/gtk/gtk.c +++ b/ext/gtk/gtk.c @@ -1172,7 +1172,7 @@ static GtkObject* try_get_gobject(self) VALUE self; { - return (GtkObject*)rb_rescue(get_gobject, self, nil, Qnil); + return (GtkObject*)rb_rescue((VALUE(*)())get_gobject, self, nil, 0); } static VALUE @@ -7,7 +7,7 @@ void memclear _((register VALUE*, register int)); VALUE assoc_new _((VALUE, VALUE)); VALUE ary_new _((void)); VALUE ary_new2 _((int)); -VALUE ary_new3 _((int,...)); +VALUE ary_new3 __((int,...)); VALUE ary_new4 _((int, VALUE *)); VALUE ary_freeze _((VALUE)); VALUE ary_aref(int, VALUE*, VALUE); @@ -84,11 +84,11 @@ VALUE enum_length _((VALUE)); VALUE exc_new _((VALUE, char*, unsigned int)); VALUE exc_new2 _((VALUE, char*)); VALUE exc_new3 _((VALUE, VALUE)); -void TypeError _((char*, ...)); -void ArgError _((char*, ...)); -void NameError _((char*, ...)); -void IndexError _((char*, ...)); -void LoadError _((char*, ...)); +void TypeError __((char*, ...)) NORETURN; +void ArgError __((char*, ...)) NORETURN; +void NameError __((char*, ...)) NORETURN; +void IndexError __((char*, ...)) NORETURN; +void LoadError __((char*, ...)) NORETURN; /* eval.c */ void rb_remove_method _((VALUE, char*)); void rb_disable_super _((VALUE, char*)); @@ -260,8 +260,8 @@ VALUE str_upto _((VALUE, VALUE)); VALUE str_inspect _((VALUE)); VALUE str_split _((VALUE, char*)); /* struct.c */ -VALUE struct_new _((VALUE, ...)); -VALUE struct_define _((char*, ...)); +VALUE struct_new __((VALUE, ...)); +VALUE struct_define __((char*, ...)); VALUE struct_alloc _((VALUE, VALUE)); VALUE struct_aref _((VALUE, VALUE)); VALUE struct_aset _((VALUE, VALUE, VALUE)); @@ -322,7 +322,7 @@ pack_pack(ary, fmt) from = NEXTFROM; if (NIL_P(from)) l = 0; else { - l = NUM2UINT(from); + l = NUM2ULONG(from); } str_cat(res, (char*)&l, sizeof(long)); } @@ -349,7 +349,7 @@ pack_pack(ary, fmt) from = NEXTFROM; if (NIL_P(from)) l = 0; else { - l = NUM2UINT(from); + l = NUM2ULONG(from); } l = htonl(l); str_cat(res, (char*)&l, sizeof(long)); @@ -377,7 +377,7 @@ pack_pack(ary, fmt) from = NEXTFROM; if (NIL_P(from)) l = 0; else { - l = NUM2UINT(from); + l = NUM2ULONG(from); } l = htovl(l); str_cat(res, (char*)&l, sizeof(long)); @@ -3603,12 +3603,8 @@ int current_mbctype = MBCTYPE_ASCII; #endif void -#ifdef __STDC__ -mbcinit(int mbctype) -#else mbcinit(mbctype) int mbctype; -#endif { switch (mbctype) { case MBCTYPE_ASCII: @@ -31,10 +31,6 @@ extern "C" { # include <strings.h> #endif -#if defined(__MWERKS__) && defined(__cplusplus) -# define NEED_PROTO -#endif - #ifndef __STDC__ # define volatile # ifdef __GNUC__ @@ -42,15 +38,26 @@ extern "C" { # else # define const # endif -#else -# define NEED_PROTO #endif -#ifdef NEED_PROTO + +#ifdef HAVE_PROTOTYPES # define _(args) args #else # define _(args) () #endif +#ifdef HAVE_STDARG_PROTOTYPES +# define __(args) args +#else +# define __(args) () +#endif + +#ifdef HAVE_ATTR_NORETURN +# define NORETURN __attribute__ ((noreturn)) +#else +# define NORETURN +#endif + #if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) #include <alloca.h> #endif @@ -435,8 +442,8 @@ char *rb_class2name _((VALUE)); void rb_p _((VALUE)); VALUE rb_eval_string _((char*)); -VALUE rb_funcall _((VALUE, ID, int, ...)); -int rb_scan_args _((int, VALUE*, char*, ...)); +VALUE rb_funcall __((VALUE, ID, int, ...)); +int rb_scan_args __((int, VALUE*, char*, ...)); VALUE rb_iv_get _((VALUE, char *)); VALUE rb_iv_set _((VALUE, char *, VALUE)); @@ -451,20 +458,20 @@ extern VALUE verbose, debug; int rb_safe_level _((void)); void rb_set_safe_level _((int)); -void Raise _((VALUE, char*, ...)); -void Fail _((char*, ...)); -void Fatal _((char*, ...)); -void Bug _((char*, ...)); -void rb_sys_fail _((char *)); -void rb_iter_break _((void)); -void rb_exit _((int)); -void rb_raise _((VALUE)); -void rb_fatal _((VALUE)); -void rb_notimplement _((void)); - -void Error _((char*, ...)); -void Warn _((char*, ...)); -void Warning _((char*, ...)); /* reports if `-w' specified */ +void Raise __((VALUE, char*, ...)) NORETURN; +void Fail __((char*, ...)) NORETURN; +void Fatal __((char*, ...)) NORETURN; +void Bug __((char*, ...)) NORETURN; +void rb_sys_fail _((char *)) NORETURN; +void rb_iter_break _((void)) NORETURN; +void rb_exit _((int)) NORETURN; +void rb_raise _((VALUE)) NORETURN; +void rb_fatal _((VALUE)) NORETURN; +void rb_notimplement _((void)) NORETURN; + +void Error __((char*, ...)); +void Warn __((char*, ...)); +void Warning __((char*, ...)); /* reports if `-w' specified */ VALUE rb_each _((VALUE)); VALUE rb_yield _((VALUE)); @@ -165,7 +165,7 @@ make_struct(name, member, klass) return nstr; } -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES #include <stdarg.h> #define va_init_list(a,b) va_start(a,b) #else @@ -174,7 +174,7 @@ make_struct(name, member, klass) #endif VALUE -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES struct_define(char *name, ...) #else struct_define(name, va_alist) @@ -249,7 +249,7 @@ struct_alloc(klass, values) } VALUE -#ifdef __STDC__ +#ifdef HAVE_STDARG_PROTOTYPES struct_new(VALUE klass, ...) #else struct_new(klass, va_alist) diff --git a/win32/config.h b/win32/config.h index cf5cb332bf..c0bbd4212c 100644 --- a/win32/config.h +++ b/win32/config.h @@ -1,4 +1,10 @@ #define THREAD 1 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_VOIDP 4 +#define HAVE_PROTOTYPES 1 +#define HAVE_STDARG_PROTOTYPES 1 +#define HAVE_ATTR_NORETURN 1 /* #define HAVE_DIRENT_H 1 */ /* #define HAVE_UNISTD_H 1 */ #define HAVE_STDLIB_H 1 diff --git a/win32/ruby.def b/win32/ruby.def index 1d04c3fabc..55e212fcae 100644 --- a/win32/ruby.def +++ b/win32/ruby.def @@ -126,6 +126,7 @@ EXPORTS rb_define_method rb_undef_method rb_define_private_method + rb_define_protected_method rb_singleton_class rb_define_singleton_method rb_define_module_function @@ -143,6 +144,7 @@ EXPORTS ; error.c Error Error_Append + Warn Warning Bug rb_check_type @@ -161,8 +163,11 @@ EXPORTS rb_sys_fail ;eval.c rb_clear_cache - rb_add_method rb_alias + rb_add_method + rb_remove_method + rb_disable_super + rb_enable_super rb_method_boundp dyna_var_defined dyna_var_ref @@ -261,7 +266,8 @@ EXPORTS num_coerce_bin float_new flo_pow - num2int + num2long + num2ulong num2fix fix2str fix_to_s |