@node Library modules - Overview, Library modules - Gauche extensions, Object system, Top @chapter Library modules - Overview @c NODE ライブラリモジュール - 概要 @c EN In the following chapters, we explain library modules bundled with Gauche's distribution. These modules should generally be loaded and imported (usually using @code{use} - @xref{Using modules}, for details), unless otherwise noted. @c JP 続くいくつかの章で、Gaucheのディストリビューションに含まれる ライブラリモジュールを解説します。 これらのモジュールを使うにあたっては、特に断りのない限り、 モジュールをロードしてimportすることが必要です (通常は@code{use}マクロが使えます。@ref{Using modules}参照)。 @c COMMON @c EN Some modules are described as "autoloaded". That means you don't need to @code{load} or @code{use} the module explicitly; at the first time the bindings are used in the program, the module is automatically loaded and imported. See @ref{Autoload}, for the details of autoloading. @c JP いくつかのモジュールは「オートロードされる」と表記されています。 この場合は、そのモジュールを使うにあたってあらかじめモジュールをロードしたり @code{use}しておく必要はありません。そのモジュールの束縛が使われた時点で、 モジュールが自動的にロードされインポートされます。オートロードの 詳細については@ref{Autoload}を参照してください。 @c COMMON @c EN As the number of bundled libraries grows, it becomes harder to find the one you need. If you feel lost, check out the section @ref{Finding libraries you need}, in which we categorize libraries by their purposes. @c JP 付属ライブラリの数が増えるにつれ、必要なライブラリを探すのが難しく なりつつあります。迷ったら、@ref{Finding libraries you need}を 見てみて下さい。目的に合わせてライブラリをカテゴライズしています。 @c COMMON @c EN The following four chapters describe bundled modules, grouped by their names. @itemize @item @ref{Library modules - Gauche extensions} contains a description of @code{gauche.*} modules, which are more or less considered the core features of Gauche but separated since less frequently used. (Some modules are rather ad-hoc, but here for historical reasons). @item @ref{Library modules - R7RS standard libraries} explains how Gauche integrates R7RS into existing Gauche structures. If you want to write R7RS-compliant portable programs, you definitely want to check the first two sections of this chapter. What follows is the description of R7RS modules. The ``small'' part of R7RS has been frozen, but the ``large'' part--additional libraries--are still growing. @item @ref{Library modules - SRFIs} describes the modules which provide SRFI functionalities. They have the names beginning with @code{srfi.}. Note that some of SRFI features are built in Gauche core and not listed here. @xref{Standard conformance}, for the entire list of supported SRFIs. @item @ref{Library modules - Utilities} describes other modules ---including database interface, filesystem utilities, network protocol utilities, and more. @end itemize @c JP この章に続く4つの章で、各ライブラリについて詳細に記述します。 各章は名前でグループ化されています。 @itemize @item @ref{Library modules - Gauche extensions}では@code{gauche.*}という 名前を持つモジュールを説明します。これらはある意味Gaucheの基本的な 機能なのですが、使われる頻度が少ないために別モジュールになったというものです。 (いくつかのモジュールはもっと付加的なものですが、歴史的理由からここにあります)。 @item @ref{Library modules - R7RS standard libraries}ではR7RSが既存のGaucheの 構造にどのように統合されているかについて説明します。R7RS準拠のポータブルな プログラムを書く場合は、この章の最初の2節にはぜひ目を通してください。 その後には、R7RSで定義されているモジュールの説明が続きます。 R7RSの``small''と呼ばれる部分は既に制定されていますが、 ``large''と呼ばれるライブラリは現在でも徐々に追加されています。 @item @ref{Library modules - SRFIs}ではSRFIの機能を提供するモジュールを 扱います。@code{srfi.}で始まる名前を持ちます。 いくつかのSRFIについてはGaucheのコアに組み込みになっているため、 この章には現れないことに注意してください。サポートされているSRFIの 完全なリストについては@ref{Standard conformance}を見て下さい。 @item @ref{Library modules - Utilities}では残りのモジュールに ついて説明します。データベースインタフェース、ファイルシステム、 ネットワークプロトコル、その他様々なライブラリがあります。 @end itemize @c COMMON @c EN There are a few procedures that help your program to check the existence of certain modules or libraries at run-time. See @ref{Operations on libraries}, for the details. @c JP 実行時にプログラムが特定のモジュールやライブラリの存在を検査できる 手続きがいくつか提供されています。 詳しくは@ref{Operations on libraries}を参照して下さい。 @c COMMON @menu * Finding libraries you need:: * Naming convention of libraries:: * Obsolete and superseded modules:: @end menu @node Finding libraries you need, Naming convention of libraries, Library modules - Overview, Library modules - Overview @section Finding libraries you need @c NODE 必要なライブラリの探し方 @c EN Each module is named more or less after what it implements rather than what it is implemented @emph{for}. If the module solves one problem, both are the same. However, sometimes there are multiple ways to solve a problem, or one implementation of an algorithm can solve multiple different problems; thus it is difficult to name the modules in problem-oriented (or purpose-oriented) way. @c JP 各モジュール名は概ね何を実装しているかを示すような名前になっていて、 @emph{何のための}実装になっているかは示していません。モジュールがひと つの問題を解くためにあるのなら両方は一致しますが、問題の解法が複数ある こともありますし、ひとつのアルゴリズムの実装が複数の異る問題を解くのに 役立つこともあります。したがって、モジュールに問題指向(あるいは目的指 向)の名前を付けることは困難です。 @c COMMON @c EN Because of this, it may not be straightforward for a newcomer to Gauche to find an appropriate Gauche module to solve her problem, since there may be multiple algorithms to do the job, and each algorithm can be implemented in different modules. @c JP というわけで、Gaucheにはじめてふれるプログラマにとって問題を解くのに適 切なGaucheモジュールを見つけるのは簡単ではないかもしれません。やるべきことに対 応するアルゴリズムは複数ありえますから、それぞれのアルゴリズムは別々の モジュールで実装されています。 @c COMMON @c EN The modules are also designed in layers; some low-level modules provide direct interface to the system calls, while some higher-level ones provide more abstract, easy-to-use interface, possibly built on top of more than one low-level modules. Which one should you use? Generally you want to use the highest level, for the very purpose of libraries are to provide easy, abstract interface. However there are times that you have to break the abstraction and to go down to tweak the machinery in the basement; then you need to use low-level modules directly. @c JP モジュールはまた、いくつもの層で実装されています。システムコールへの直接のインタフェース を提供する低レベルモジュールもあれば、複数の低レベルモジュールを使って 構築された、より抽象化され使いやすい高レベルモジュールもあります。さて どれを使えばよいでしょう。通常もっとも高レベルのものを使うのがよいでしょ う。やさしく使える抽象度の高いインタフェースを提供するというのがまさに ライブラリの目的だからです。とはいうものの、場合によっては抽象の壁をや ぶってその下にあるメカニズムに触らなければ出来ないこともあります。そ ういうときには低レベルのモジュールを直接使う必要があります。 @c COMMON @c EN The purpose of this section is to group the libraries by their purposes. Each category lists relevant modules with brief descriptions. @c JP ここではライブラリをその目的にしたがってグループ分けします。各カテゴリ ごとに関連するモジュールをあげ、簡単な説明をしています。 @c COMMON @menu * Library directory - data containers:: * Library directory - strings and characters:: * Library directory - data exchange:: * Library directory - files:: * Library directory - processes and threads:: * Library directory - networking:: * Library directory - input and output:: * Library directory - time:: * Library directory - bits and bytes:: @end menu @node Library directory - data containers, Library directory - strings and characters, Finding libraries you need, Finding libraries you need @subsection Library directory - data containers @c NODE ライブラリディレクトリ - データコンテナ @c EN @subsubheading Generic container operations @c JP @subsubheading ジェネリックなコンテナ操作 @c COMMON @c EN Some data containers have similar properties; for example, lists, vectors and hash tables can be seen as a collection of data. So it is handy to have generic operators, such as applying a procedure to all the elements. @c JP 似たような性質をもつデータコンテナがあります。たとえば、リスト、ベクタ、 ハッシュテーブルはデータのコレクションとして見ることができます。それゆ え、すべての要素に適用できるようなジェネリックな操作があれば便利です。 @c COMMON @c EN Gauche provides such mechanism to a certain degree, mainly using its object system. @c JP Gaucheでは主にオブジェクトシステムで使うためにこのような機構をある程度 用意されています。 @c COMMON @c EN @itemize @bullet @item @emph{Collection} - Generic functions applicable for unordered set of values. @xref{Collection framework}. @item @emph{Sequence} - Generic functions applicable for ordered set of values. @xref{Sequence framework}. @item @emph{Dictionary} - Generic functions to handle dictionary, that is, a mapping from keys to values. @xref{Dictionary framework}. @item @emph{Relation} - Generic functions to handle relations (in a sense of Codd's definition). @xref{Relation framework}. @item @emph{Comprehension} - This is a collection of macros very handy to construct and traverse collections/sequences in concise code. @xref{Eager comprehensions}. @end itemize @c JP @itemize @bullet @item @emph{コレクション} - 順序付けられていないデータの集合に対するジェネリッ ク関数。@ref{Collection framework}参照。 @item @emph{シーケンス} - 順序付けられたデータの集合に対するジェネリック関数。 @ref{Sequence framework}参照。 @item @emph{ディクショナリ} - 辞書、つまりキーから値への写像に対するジェネリック関数。 @ref{Dictionary framework}参照。 @item @emph{リレーション} - (Coddの定義による)リレーションを処理するためのジェ ネリック関数。@ref{Relation framework}参照。 @item @emph{内包表記} - コレクションやシーケンスの構築やトラバースを短く便利 に書くためのマクロ集。@ref{Eager comprehensions}参照。 @end itemize @c COMMON @c EN @subsubheading Container implementations @c JP @subsubheading コンテナの実装 @c COMMON @c EN @itemize @bullet @item @emph{List} - the universal data structure. You want to check @ref{Pairs and lists} and @ref{R7RS lists} @item @emph{Vector} - a one-dimensional array of arbitrary Scheme values. See @ref{Vectors} and @ref{R7RS vectors}. If you need a wide range of index, but the actual data is sparse, you might want to look at @ref{Sparse vectors}. @item @emph{Uniform vector} - a special kind of vectors that can hold limited types of values (e.g. integers representable in 8bits). It tends to be used in performance sensitive applications, such as graphics. See @ref{Uniform vectors}. @item @emph{Array} - multi-dimensional arrays that can hold arbitrary Scheme values. See @ref{Arrays}. @item @emph{Uniform array} - multi-dimensional arrays that can hold limited types of values. This is also supported by @ref{Arrays}. @item @emph{String} - a sequence of characters. See @ref{Strings} and @ref{String library}. Gauche handles multibyte strings--- see @ref{Multibyte strings} for the details. @item @emph{Character set} - a set of characters. See @ref{Character sets} and @ref{R7RS character sets}. @item @emph{Hash table} - hash tables. See @ref{Hashtables}. For very large hash tables (millions of entries), @ref{Sparse tables} may provide better memory footprint. @item @emph{Balanced tree} - If you need to order keys in a dictionary, you can use treemaps. See @ref{Treemaps}. @item @emph{Immutable map} - Sometimes immutable dictionary is handy. Internally it implements a functional balanced tree. See @ref{Immutable map}. @item @emph{Queue} - Both fast and thread-safe queues are provided in @ref{Queue}. Thread-safe queues can also be used as synchronized messaging channel. @item @emph{Heap} - See @ref{Heap}. @item @emph{Ring buffer} - Space-efficient ring buffer. See @ref{Ring buffer}. @item @emph{Cache} - Various cache algorithm implementations. See @ref{Cache}. @item @emph{Record} - a simple data structure. Although Gauche's object system can be used to define arbitrary data structures, you might want to look at @ref{Record types} and @ref{SLIB-compatible record type}, for they are more portable and potentially more efficient. @item @emph{Stream} - you can implement cool lazy algorithms with it. See @ref{Stream library}. @item @emph{Trie} - Another tree structure for efficient common-prefix search. See @ref{Trie}. @item @emph{Database interface} - dbm interface can be used as a persistent hash table; see @ref{Generic DBM interface}. For generic RDBMS interface, see @ref{Database independent access layer}. @end itemize @c JP @itemize @bullet @item @emph{リスト} - もっともよく使うデータ構造。 @ref{Pairs and lists}と@ref{R7RS lists}をチェックしましょう。 @item @emph{ベクタ} - 任意のSchemeの値を格納する一次元配列。@ref{Vectors}お よび@ref{R7RS vectors}を見ましょう。 広い範囲のインデックスが必要で、しかし実際に格納されるデータが疎である場合は @ref{Sparse vectors}が使えるかもしれません。 @item @emph{ユニフォームベクタ} - 制限された型の値(たとえば8ビット整数)を保 持する特別なベクタ。グラフィックなどパフォーマンスが要求されるアプリケー ション用。@ref{Uniform vectors}参照。 @item @emph{配列} - 任意のScheme値を保持できる多次元配列。@ref{Arrays}参照。 @item @emph{ユニフォーム配列} - 制限された型の値を保持する多次元配列。これも @ref{Arrays}でサポートされている。 @item @emph{文字列} - 文字のシーケンス。@ref{Strings}および @ref{String library}参照。Gaucheではマルチバイト文字列を扱えます。詳細 については@ref{Multibyte strings}を見てください。 @item @emph{文字集合} - 文字の集合。@ref{Character sets}および @ref{R7RS character sets}参照。 @item @emph{ハッシュテーブル} - ハッシュテーブル。 @ref{Hashtables}参照。 非常に大きなハッシュテーブル(数百万エントリ)の場合、 @ref{Sparse tables}の方がメモリ効率が良い可能性もあります。 @item @emph{平衡木} - 辞書のキーに順序づけが必要な場合はツリーマップがが利用できます。 @ref{Treemaps}参照。 @item @emph{不変なマップ} - しばしは、変更不可能な辞書が便利な場面があります。 内部では関数的な平衡木として実装されています。@ref{Immutable map}参照。 @item @emph{キュー} - 高速なキュー、およびスレッドセーフなキューが@ref{Queue}で用意されています。 スレッドセーフキューはまた、同期的なメッセージチャネルとしても使えます。 @item @emph{ヒープ} - @ref{Heap}参照。 @item @emph{リングバッファ} - 空間効率の良いリングバッファです。@ref{Ring buffer}参照。 @item @emph{キャッシュ} - 様々なキャッシュアルゴリズムの実装です。 @ref{Cache}参照。 @item @emph{レコード} - 単純なデータ構造。Gaucheのオブジェクトシステムをつかっ て任意のデータ構造を定義できますが、@ref{Record types}および @ref{SLIB-compatible record type}を検討するのもいいでしょう。こちらの 方がポータブルで高効率です。 @item @emph{ストリーム} - これを使うと遅延アルゴリズムをスマートに実装できま す。@ref{Stream library}参照。 @item @emph{トライ} - 共通接頭辞検索用の効率のよい木構造です。@ref{Trie}参照。 @item @emph{データベースインタフェース} - dbmインタフェースが永続的ハッシュ テーブルとして利用できます。@ref{Generic DBM interface}参照。ジェネリッ クなRDBMSへのインタフェースについては、 @ref{Database independent access layer}を見てください。 @end itemize @c COMMON @node Library directory - strings and characters, Library directory - data exchange, Library directory - data containers, Finding libraries you need @subsection Library directory - string and character @c NODE ライブラリディレクトリ - 文字列と文字 @c EN Basic string operations are covered in @ref{Strings} and @ref{String library}. A string is also a sequence of characters, so you can apply methods in @ref{Collection framework} and @ref{Sequence framework}. @c JP 文字列の基本操作は@ref{Strings}および@ref{String library}でカバーされ ています。文字列は文字のシーケンスでもありますので、 @ref{Collection framework}および@ref{Sequence framework}のメソッドを適 用可能です。 @c COMMON @c EN Character and character set operations are covered in @ref{Characters}, @ref{Character sets}, and @ref{R7RS character sets}. @c JP 文字および文字集合の操作は @ref{Characters}、@ref{Character sets}、@ref{R7RS character sets}がカ バーしています。 @c COMMON @c EN If you scan or build strings sequentially, do not use index access. String ports (see @ref{String ports}) provides more efficient, and elegant way. @c JP 文字列を先頭から順に操作したり構築したりする場合にはインデックスによる アクセスは行いません。文字列ポート(@ref{String ports}参照)はさらに 効率のよいエレガントな方法を提供しています。 @c COMMON @c EN You can use regular expressions to search and extract character sequences from strings; see @ref{Regular expressions}. @c JP 文字列から文字のならびを検索したり、とりだしたりするのに正規表現が使え ます。@ref{Regular expressions}参照。 @c COMMON @c EN If you need to deal with low-level (i.e. byte-level) representation of strings, @ref{Uniform vectors} has some tools to convert strings and byte vectors back and forth. @c JP 文字列の低レベル(たとえばバイトレベル)表現を扱う必要があるなら @ref{Uniform vectors}に文字列とバイトベクタ相互の変換をおこなうツール があります。 @c COMMON @c EN Are you dealing with a structure higher than a mere sequence of characters? Then take a look at @code{text.*} modules. @ref{Parsing input stream} has some basic scanners. @ref{Transliterate characters} implements a feature similar to Unix's @code{tr(1)}. You can take @code{diff} of two texts; see @ref{Calculate difference of text streams}. And if you want to construct large text from string fragments, do not use @code{string-append}---see @ref{Lazy text construction}. @c JP 文字の単なるシーケンスよりも高次の構造を扱いたいのですか。それなら @code{text.*}モジュールを見てください。@ref{Parsing input stream}には 基本的なスキャナの実装が用意されています。 @ref{Transliterate characters}はUnixの@code{tr(1)}に似た機能を実装して います。2つのテキストの@code{diff}をとることもできます。これについては @ref{Calculate difference of text streams}を見てください。文字列の断片 から大きな文字列を構成したいのなら、@code{string-append}を使ってはいけ ません。@ref{Lazy text construction}参照。 @c COMMON @c EN Last but not least, Gauche has support of various character encoding schemes. See @ref{Character code conversion} for the basic utilities. Most higher-level functions such as @code{open-input-file} can take @code{:encoding} keyword argument to perform character conversion implicitly. Also see @ref{Multibyte scripts} if you write Scheme program in non-ASCII characters. If you want to process Gauche source code which may contain "encoding" magic comment, see @ref{Coding-aware ports}. Gauche also has GNU gettext compatible module (@ref{Localized messages}) if you need localization. @c JP 大事なことを言い忘れました。Gaucheはさまざまな文字エンコーディングをサ ポートしています。基本的な関数については @ref{Character code conversion}を見てください。@code{open-input-file} のようなもっとも高次の関数のほとんどは、@code{:encoding}キーワード引数 をとり、文字の変換を暗黙におこないます。非ASCII文字でSchemeのプログラ ムを書きたい場合には@ref{Multibyte scripts}を見てください。encodingと いうマジックコメントを含むGaucheのソースコードを処理したいなら @ref{Coding-aware ports}を見てください。地域化が必要なら、Gaucheには GNU gettext互換のモジュール(@ref{Localized messages})もあります。 @c COMMON @node Library directory - data exchange, Library directory - files, Library directory - strings and characters, Finding libraries you need @subsection Library directory - data exchange @c NODE ライブラリディレクトリ - データ交換 @c EN Most useful programs need to communicate with outside world (other programs or humans). That involves reading the external data into your program understanding whatever format the data is in, and also writing the data in the format the others can understand. @c JP ほとんどのプログラムでは外界(他のプログラムや人間)とコミュニケーション する必要があります。ということは外部データを読み込んでそれがどのような フォーマットで書かれているかを判別したり、他のプログラムが理解できる フォーマットでデータを書き出したりするということです。 @c COMMON @c EN Lots of network-related external formats are defined in RFC, and there are corresponding @code{rfc.*} module that handle some of them. See @ref{RFC822 message parsing}, for example, to handle the pervasive RFC2822 message format. Or, JSON can be handled by @ref{JSON parsing and construction}. @c JP ネットワークに関連する外部フォーマットの多くはRFCで規定されており、そ れらのいくつかに対応するRFCモジュール(@code{rfc.*})があります。たとえ ばよく知られたRFC2822のメッセージフォーマットを処理するには @ref{RFC822 message parsing}を見てください。 @c COMMON @c EN When you exchange table-formatted data, one of the easiest way may be the plain text, one row per line, and columns are separated by some specific characters (e.g. comma). See @ref{CSV tables} for basic parser/writer for them. @c JP 表形式のデータを交換するのにもっとも便利な方法は表の一行をプレーンテキ ストの一行に対応させることです。そしてカラムは特定の文字で区切ります。 たとえば、コンマで区切ります。これらの解析と書き出し用の基本手続につい ては@ref{CSV tables}を見てください。 @c COMMON @c EN Oh, and nowadays every business user wants XML, right? You know they are just S-expressions with extra redundancy and pointy parentheses. So why don't you read XML as if they're S-exprs, process them with familiar cars and cdrs and maps, then write them out with extra redundancy and pointy parens? Module @code{sxml.ssax} (@ref{Functional XML parser}) implements SAX XML parser, with which you can parse XML and process them on the fly, or convert it to SXML, S-expression XML. You can query SXML using SXPath, an XPath counterparts of S-expression (@ref{SXML query language}). You can output all kinds of XML and HTML using the SXML serializer (@ref{Serializing XML and HTML from SXML}). @c JP 今どきのビジネスユーザはXMLを欲しがるというのですか。いいでしょう。まぁ 彼らが欲しいのは尖った括弧のえらい冗長なS式なんですから、XMLをS式と して読み込んで、自家籠中の car とか cdr とか map でちょちょいと処理し てえらい冗長な尖った括弧で書き出せばいいですよね。 @code{sxml.ssax}モジュール(@ref{Functional XML parser})はSAX XMLパーザ の実装です。これを使えば、おてがるにXMLをパーズしたり処理したり、ある いはまた、SXML(S式XML)に変換することもできます。SXPath(XPathに対応する S式(@ref{SXML query language}))を使ってSXMLクエリを発行することもでき ます。SXMLシリアライザを使えば、すべての種類のXMLやHTMLをはきだすこと もできます(@ref{Serializing XML and HTML from SXML})。 @c COMMON @c EN (But you know most web services nowadays also talks JSON, and that's much lighter and handier than XML. See @ref{JSON parsing and construction}). @c JP (でもいまどきのwebサービスならたいていはJSONも話しますし、そっちの方が 手軽だっていうなら、@ref{JSON parsing and construction}を見てみると良いかも しれません。) @c COMMON @c EN It is planned that various file format handling routines would be available as @code{file.*} modules, though we have none ready yet. If you plan to write one, please go ahead and let us know! @c JP さまざまなファイルフォーマットを処理するルーチンを@code{file.*}という モジュールで使えるようにしようという計画はあるのですが、まだなにも準備 できていません。ひとつ自分で書いてやろうという人がいたら是非おねがいし たいので、おしらせ下さい。 @c COMMON @node Library directory - files, Library directory - processes and threads, Library directory - data exchange, Finding libraries you need @subsection Library directory - files @c NODE ライブラリディレクトリ - ファイル @c EN Files and directories. Roughly speaking, there are two places you want to look at. @c JP ファイルおよびディレクトリ。おおざっぱに言うと見るべきところは2箇所で す。 @c COMMON @c EN @ref{Filesystems}, in the core, has routines close to the underlying OS provides. If you have experience with Unix system programming you'll find familiar function names there. The @code{fcntl} functionality is splitted to @code{gauche.fcntl} (@ref{Low-level file operations}), FYI. @c JP @ref{Filesystems}のコア部分には下位のOSが提供しているに近いルーチンが あります。Unixのシステムプログラミングの経験があれば、よく知っている関 数名がばかりだと思うでしょう。ちなみに@code{fcntl}の機能は @code{gauche.fcntl} (@ref{Low-level file operations})にあります。 @c COMMON @c EN Also you definitely want to look at @code{file.util} (@ref{Filesystem utilities}), which implements higher-level routines on top of system-level ones. @c JP まちがいなく@code{file.util}(@ref{Filesystem utilities})を使いたいこと でしょう。これはシステムレベル上で実装された高次レベルのルーチン群です。 @c COMMON @node Library directory - processes and threads, Library directory - networking, Library directory - files, Finding libraries you need @subsection Library directory - processes and threads @c NODE ライブラリディレクトリ - プロセスとスレッド @c EN Process-related routines also come in two levels. @c JP プロセス関連のルーチンも2つのレベルで提供されます。 @c COMMON @c EN The @code{gauche.process} module provides high-level routines (@ref{High-level process interface}); you can pipe the data into and out of child processes easily, for example. @c JP @code{gauche.process}モジュールは高レベルのルーチン (@ref{High-level process interface})を提供しています。これを使えば、た とえば、データを子プロセスとの間でパイプすることが簡単にできます。 @c COMMON @c EN Gauche core provides the primitive @code{fork} and @code{exec} interface as well as the convenient @code{system} call (see @ref{Process management}). Use them when you want a precise control over what you're doing. @c JP Gaucheコアはプリミティブな@code{fork}および@code{exec}のインタフェース を、便利な@code{system}コール(@ref{Process management}参照)同様提 供しています。やりたいことを細かくコントロールしたい場合に使うとよいで しょう。 @c COMMON @c EN Gauche has preemptive threads on most Unix platforms including OSX. Check out @ref{Threads} for the basic thread support, including primitive mutexes. The @code{data.queue} module (@pxref{Queue}) provides thread-safe queue that can also be handy for synchronization. Thread pool is available in @code{control.thread-pool} (@pxref{Thread pools}). @c JP GaucheはOSXを含む多くのUnixプラットフォームでプリエンプティブなスレッドを サポートしています。低レベルの排他制御を含む基本的なスレッドのサポートについては @ref{Threads}を参照してください。@code{data.queue}モジュール (@ref{Queue}参照)では、スレッド間同期にも使えるスレッドセーフなキューを 提供しています。スレッドプールは@code{control.thread-pool} (@ref{Thread pools}参照) によって提供されます。 @c COMMON @node Library directory - networking, Library directory - input and output, Library directory - processes and threads, Finding libraries you need @subsection Library directory - networking @c NODE ライブラリディレクトリ - ネットワーク @c EN We have multi-layer abstraction here. At the bottom, we have APIs corresponding to socket-level system calls. In the middle, a convenience library that automates host name lookups, connection and shutdown, etc. On top of them we have several modules that handles specific protocols (e.g. http). @c JP これは抽象の層が複数あります。最下層ではソケットレベルのシステムコール に対応するAPIがあります。中間層ではホスト名の解決、コネクション、シャッ トダウンなどを自動でやるような便利なライブラリになっています。最上層で は、たとえばHTTPのような特定のプロトコルを扱うためのモジュールがいくつ か用意されています。 @c COMMON @c EN The @code{gauche.net} module (@ref{Networking}) provides the bottom and middle layer. For the top layer, look for @code{rfc.*} modules, e.g. @code{rfc.http} (@ref{HTTP client}). More protocol support is coming (there are @code{rfc.ftp} and @code{rfc.imap4} written by users, which are waiting for being integrated into Gauche---maybe in next release). @c JP @code{gauche.net}モジュール(@ref{Networking})は最下層と中間層を提供し ています。最上層については@code{rfc.*}モジュールを探してみて下さい。 たとえば @code{rfc.http} (@ref{HTTP client})です。 その他のプロトコルについてもまもなくサポートされる予定です。 @code{rfc.ftp}や@code{rfc.imap4}はすでにユーザの方々が書いてくれていて、 Gaucheにとりこまれるのを待っている状態にあります。おそらく次のリリース で統合されるでしょう。 @c COMMON @c EN There's a plan of even higher level of libraries, under the name @code{net.*}, which will abstract more than one network protocols. The planned ones include sending emails, or universal resource access by uri. Code contributions are welcome. @c JP さらに複数のプロトコルを抽象化して@code{net.*}という名前のさらに高次レ ベルのライブラリの計画もあります。emailの送信あるいはURIによるリソース アクセスなどの計画があります。コードの貢献は歓迎します。 @c COMMON @node Library directory - input and output, Library directory - time, Library directory - networking, Finding libraries you need @subsection Library directory - input and output @c NODE ライブラリディレクトリ - 入出力 @node Library directory - time, Library directory - bits and bytes, Library directory - input and output, Finding libraries you need @subsection Library directory - time @c NODE ライブラリディレクトリ - 時間 @node Library directory - bits and bytes, , Library directory - time, Finding libraries you need @subsection Library directory - bits and bytes @c NODE ライブラリディレクトリ - ビットとバイト @c EN @subsubheading Binary I/O @c JP @subsubheading バイナリ入出力 @c COMMON @c EN As the bottom level, Gauche includes primitive byte I/O (@code{read-byte}, @code{write-byte}) as well as block I/O (@code{read-uvector}, @code{read-uvector!}, @code{write-uvector}) in its core. (See @ref{Reading data}, @ref{Output}, and @ref{Uvector block I/O}). @c JP 最下層としてGaucheはコアに含まれるブロック入出力(@code{read-uvector}, @code{read-uvector!} 、@code{write-uvector})と同様、バイト入出力のプリミティブ (@code{read-byte}、@code{write-byte})も含んでいます (@ref{Reading data}、@ref{Output}、@ref{Uvector block I/O}参照)。 @c COMMON @c EN As the middle level, the module @code{binary.io} (@ref{Binary I/O}) has routines to retrieve specific datatype with optional endian specification. @c JP 中間層としては、@code{binary.io}(@ref{Binary I/O})モジュールには オプションでエンディアンを指定できる特定のデータを取得するルーチンがあ ります。 @c COMMON @c EN And as the top level, the module @code{binary.pack} (@ref{Packing binary data}) allows packing and unpacking structured binary data, a la Perl's @code{pack}/@code{unpack}. @c JP そして最上層としては、@code{binary.pack}(@ref{Packing binary data}) モジュールがあって、構造をもつバイナリデータのパック、アンパックを可能 にしています。Perlでいう@code{pack}/@code{unpack}です。 @c COMMON @c EN @subsubheading Bit manipulation @c JP @subsubheading ビット操作 @c COMMON @c EN Gauche core provides basic bitshift and mask operations (@pxref{Basic bitwise operations}). SRFI-151 has comprehensive bitwise operations (@pxref{R7RS bitwise operations}). @c JP Gaucheコアは基本的なビットシフトおよびマスク操作を提供しています (@ref{Basic bitwise operations}参照)。 SRFI-151はより包括的なビット演算を提供します (@ref{R7RS bitwise operations}参照)。 @c COMMON @node Naming convention of libraries, Obsolete and superseded modules, Finding libraries you need, Library modules - Overview @section Naming convention of libraries @c NODE ライブラリの命名規則 @c EN The following table summarizes naming categories of the modules, including external ones and planned ones. @c JP 下の表は、モジュールの名前付けの分類を示します。 外部モジュール、及び将来予定されているモジュールも含みます。 @c COMMON @table @code @item binary.* @c EN Utilities to treat binary data. @c JP バイナリデータを扱うためのユーティリティ。 @c COMMON @item compat.* @c EN Provides compatibility layers. @c JP 互換性のためのレイヤを提供。 @c COMMON @item control.* @c EN Control structures, such as multithreading utilities @c JP マルチスレッドユーティリティなどの制御機構 @c COMMON @item data.* @c EN Implementations of various data structures. @c JP 様々なデータ構造の実装 @c COMMON @item dbi.*, dbd.* @c EN Database independent interface layer and drivers. @c JP データベース独立インタフェース層とドライバー。 @c COMMON @item dbm.* @c EN DBM interface @c JP DBMインタフェース @c COMMON @item gauche.* @c EN Stuffs more or less considered as Gauche core features. @c JP Gauche本体の一部として考えられている機能。 @c COMMON @item gl.* @c EN OpenGL binding and related libraries (external package). @c JP OpenGLバインディングと関連するライブラリ (外部パッケージ)。 @c COMMON @item gtk.* @c EN GTk+ binding and related libraries (external package). @c JP GTk+バインディングと関連するライブラリ (外部パッケージ)。 @c COMMON @item file.* @c EN Manipulating files and directories. @c JP ファイルとディレクトリの操作。 @c COMMON @item lang.* @c EN Language-related libraries, artificial and/or natural (planned). @c JP 言語に関するライブラリ(人工的なものも自然言語関連も)。(予定) @c COMMON @item math.* @c EN Mathematics. @c JP 数学。 @c COMMON @item os.* @c EN Features for specific OSes. @c JP 特定のOS向けの機能。 @c COMMON @item parser.* @c EN Parsers @c JP パーザ (構文解析) @c COMMON @item rfc.* @c EN Implementations of net protocols defined in RFC's. @c JP RFCで定義されているデータフォーマットやネットワークプロトコルの実装。 @c COMMON @item scheme.* @c EN R7RS libraries @c JP R7RSライブラリ @c COMMON @item srfi.* @c EN SRFI implementations. @c JP SRFIの実装 @c COMMON @item sxml.* @c EN SXML libraries. @c JP SXMLライブラリ。 @c COMMON @item text.* @c EN Libraries dealing with text data. @c JP テキストデータを扱うライブラリ @c COMMON @item util.* @c EN Generic implementations of various algorithms. @c JP 汎用的なアルゴリズムの実装。 @c COMMON @item www.* @c EN Implementations of various protocols and formats mainly used in WWW. @c JP WWWで主として使われるプロトコルやデータフォーマットの実装。 @c COMMON @end table @node Obsolete and superseded modules, , Naming convention of libraries, Library modules - Overview @section Obsolete and superseded modules @c NODE 廃止あるいは置き換えられたモジュール @c EN During the course of development of Gauche, some modules have been renamed, merged, or dissolved into the core. Also, some SRFI libraries become standard and given a new name, or superseded with a newer SRFI library. @c JP Gaucheの開発の過程で、いくつかのモジュールは名前が変わったり、 合併したり、あるいはコアに取り込まれたりしてきました。 また、いくつかのSRFIライブラリは標準に取り込まれ新しい名前をつけられたり、 より新しいSRFIで置き換えられたりしています。 @c COMMON @c EN We list such modules here for the reference. New code shouldn't use these modules, although they are kept in the distribution so that legacy code can keep running. @c JP 参考のため、それらのモジュールをここにリストしておきます。 新たなコードはこれらのモジュールを使うべきではありませんが、 古いコードがそのまま動きつづけるよう、Gaucheの配布物の中にはこれらの モジュールが含まれています。 @c COMMON @c EN @subheading Obsolete modules @c JP @subheading 廃止されたモジュール @c COMMON @deftp {Module} text.unicode @mdindex text.unicode @c EN Renamed to @code{gauche.unicode}. @xref{Unicode utilities}. @c JP @code{gauche.unicode}へと名前変更。@ref{Unicode utilities}参照。 @c COMMON @end deftp @deftp {Module} util.list @mdindex util.list @c EN Dissolved into the core. No longer needed. @c JP コアに吸収されました。もう必要ありません。 @c COMMON @end deftp @deftp {Module} util.queue @mdindex util.queue @c EN Renamed to @code{data.queue}. @xref{Queue}. @c JP @code{data.queue}へと名前変更。@ref{Queue}参照。 @c COMMON @end deftp @deftp {Module} util.rbtree @mdindex util.rbtree @clindex rbtree @findex make-rbtree @findex rbtree? @findex rbtree-copy @findex rbtree-empty? @findex rbtree-num-entries @findex rbtree-exists? @findex rbtree-get @findex rbtree-put! @findex rbtree-delete! @findex rbtree-update! @findex rbtree-push! @findex rbtree-pop! @findex rbtree-min @findex rbtree-max @findex rbtree-extract-min! @findex rbtree-extract-max! @findex rbtree-fold @findex rbtree-fold-right @findex rbtree-keys @findex rbtree-values @findex rbtree->alist @findex alist->rbtree @c EN Incorporated into the core as built-in object @code{}. @xref{Treemaps}. @c JP コアに吸収され、組み込みオブジェクト@code{}になりました。 @ref{Treemaps}参照。 @c COMMON @c EN The following procedures are aliases of the ones with replacing @code{rbtree} for @code{tree-map}, e.g. @code{rbtree-get} is the same as @code{tree-map-get}. @c JP 以下の手続きは、@code{rbtree}を@code{tree-map}に変えた手続きの別名と なっています。例えば@code{rbtree-get}は@code{tree-map-get}と同じです。 @c COMMON @example make-rbtree rbtree? rbtree-get rbtree-put! rbtree-delete! rbtree-exists? rbtree-empty? rbtree-update! rbtree-push! rbtree-pop! rbtree-num-entries rbtree->alist alist->rbtree rbtree-keys rbtree-values rbtree-copy rbtree-fold rbtree-fold-right @end example @c EN The following procedures are similar to @code{tree-map-min}, @code{tree-map-max}, @code{tree-map-pop-min!} and @code{tree-map-pop-max!}, respectively, except that the @code{rbtree-*} version takes an optional default argument and returns it when the tree is empty, and raise an error if no default argument is provided and tree is empty. (The tree-map version just returns @code{#f} for the empty tree.) @c JP 以下の手続きはそれぞれ@code{tree-map-min}、@code{tree-map-max}、 @code{tree-map-pop-min!}、@code{tree-map-pop-max!}とほぼ同じですが、 省略可能なデフォルト引数を取り、tree-mapが空の時にそれを返す点が異なります。 デフォルト引数が与えられなければ空のtree-mapに対してはエラーを投げます。 (@code{tree-map-min}等は、tree-mapが空の場合には@code{#f}を返します)。 @c COMMON @example rbtree-min rbtree-max rbtree-extract-min! rbtree-extract-max! @end example @c EN The following procedure doesn't have corresponding API in tree-map. It checks internal consistency of the given tree-map. @c JP 以下の手続きはtree-mapに相当する手続きを持ちません。これは与えられたtree-mapの 内部整合性を検査する手続きです。 @c COMMON @example rbtree-check @end example @end deftp @deftp {Module} util.sparse @mdindex util.sparse @c EN Renamed to @code{data.sparse}. @xref{Sparse data containers}. @c JP @code{data.sparse}へと名前変更。@ref{Sparse data containers}参照。 @c COMMON @end deftp @deftp {Module} util.trie @mdindex util.trie @c EN Renamed to @code{data.trie}. @xref{Trie}. @c JP @code{data.trie}へと名前変更。@ref{Trie}参照。 @c COMMON @end deftp @c EN @subheading Superseded modules @c JP @subheading 置き換えられたモジュール @c COMMON @c Note: Don't use mdindex below, for the entries of these modules @c are still in the modsrfi.texi. @deftp {Module} srfi.1 @c EN SRFI-1 (List library) has become a part of R7RS large, as @code{scheme.list}. @xref{R7RS lists}. @c JP SRFI-1(リストライブラリ)はR7RS largeに採り入れられ、 @code{scheme.list}モジュールになりました。 @ref{R7RS lists}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.14 @c EN SRFI-14 (Character-set library) has become a part of R7RS large, as @code{scheme.charset}. @xref{R7RS character sets}. @c JP SRFI-14(文字集合ライブラリ)はR7RS largeに採り入れられ、 @code{scheme.charset}モジュールになりました。 @ref{R7RS character sets}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.43 @c EN Vector library (Legacy) - this module is effectively superseded by R7RS and @code{srfi.133}. @xref{Vectors}, and @pxref{R7RS vectors}. @c JP ベクタライブラリ(旧式) - このモジュールは実効的に、R7RSと@code{srfi.133}に取って代わられています。 @ref{Vectors}と@ref{R7RS vectors}参照。 @c COMMON @end deftp @deftp {Module} srfi.60 @c EN Integers as bits - this module is superseded by @code{srfi.151}. @xref{R7RS bitwise operations}. @c JP 整数に対するビット操作 - このモジュールは@code{srfi.151}に取って代わられています。 @ref{R7RS bitwise operations}参照。 @c COMMON @end deftp @deftp {Module} srfi.69 @c EN Basic hash tables - this module is superseded by R7RS @code{scheme.hash-table}. @xref{R7RS hash tables}. @c JP 基本的なハッシュテーブル - このモジュールはR7RSの@code{scheme.hash-table}に 取って代わられています。 @ref{R7RS hash tables}参照。 @c COMMON @end deftp @deftp {Module} srfi.111 @c EN SRFI-111 (Boxes) has become a part of R7RS @code{scheme.box} module. @xref{R7RS boxes}. @c JP SRFI-111 (ボックス) はR7RS largeの@code{scheme.box}モジュールになりました。 @ref{R7RS boxes}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.113 @c EN SRFI-113 (Sets and bags) has become a part of R7RS @code{scheme.set}. @xref{R7RS sets}. @c JP SRFI-113(setとbag)はR7RS largeの@code{scheme.set}モジュールになりました。 @ref{R7RS sets}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.114 @c EN Comparators - R7RS favored SRFI-128 over this srfi to make @code{scheme.comparator} (@ref{R7RS comparators}), so adoption of this srfi may not be as wide. Note that, in Gauche, a native comparator object can be used for SRFI-114 procedures, and this module provides some useful additional utilities. It's ok to use this module if portability isn't a big issue. @c JP 比較器 - R7RSは@code{scheme.comparator} (@ref{R7RS comparators}参照) としてこれではなくSRFI-128を採用したので、将来このsrfiが広く採用されることは ないかもしれません。 ただ、Gaucheでは組み込みの比較器オブジェクトをそのままSRFI-114の手続きにも 使うことが出来るので、ポータビリティが重要でないコードではユーティリティライブラリとして このsrfiを使っても良いでしょう。 @c COMMON @end deftp @deftp {Module} srfi.117 @c EN SRFI-117 has become R7RS's @code{scheme.list-queue}. @xref{R7RS list queues}. @c JP SRFI-117はR7RSの@code{scheme.list-queue}モジュールになりました。 @ref{R7RS list queues}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.127 @c EN SRFI-127 has become R7RS's @code{scheme.lseq}. @xref{R7RS lazy sequences}. @c JP SRFI-127はR7RSの@code{scheme.lseq}モジュールになりました。 @ref{R7RS lazy sequences}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.132 @c EN SRFI-132 has become R7RS's @code{scheme.sort}. @xref{R7RS sort}. @c JP SRFI-132はR7RSの@code{scheme.sort}モジュールになりました。 @ref{R7RS sort}を参照してください。 @c COMMON @end deftp @deftp {Module} srfi.133 @c EN SRFI-133 has become R7RS's @code{scheme.vector}. @xref{R7RS vectors}. @c JP SRFI-133はR7RSの@code{scheme.vector}モジュールになりました。 @ref{R7RS vectors}を参照してください。 @c COMMON @end deftp @c Local variables: @c mode: texinfo @c coding: utf-8 @c end: