Skip to content

Commit 76c0d18

Browse files
committed
wip
1 parent 3c061e3 commit 76c0d18

File tree

4 files changed

+34
-37
lines changed

4 files changed

+34
-37
lines changed

reference/ffi/ffi.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@
2121
新しい C のデータ構造を作成するのに使用できます。
2222
</para>
2323
<para>
24+
FFI 定義のパースや共有ライブラリの読み込みには長い時間がかかることがあります。
25+
Web 環境において、各 HTTP リクエストでこれを行うのは不便です。
26+
しかし、FFI 定義やライブラリを PHP の起動時に事前ロードし、FFI オブジェクトを必要なときにインスタンス化することが可能です。
2427
!!!
25-
FFI definition parsing and shared library loading may take significant time. It is not useful
26-
to do it on each HTTP request in a Web environment. However, it is possible to preload FFI definitions
27-
and libraries at PHP startup, and to instantiate FFI objects when necessary. Header files
28-
may be extended with special <literal>FFI_SCOPE</literal> defines (e.g. <code>#define FFI_SCOPE "foo"</code>;
29-
the default scope is "C") and then loaded by <methodname>FFI::load</methodname> during preloading.
28+
29+
Header files
30+
may be extended with special <literal>FFI_SCOPE</literal> defines (例: <code>#define FFI_SCOPE "foo"</code>
31+
デフォルトのスコープは "C" です) and then loaded by <methodname>FFI::load</methodname> during preloading.
32+
3033
This leads to the creation of a persistent binding, that will be available to all the following
3134
requests through <methodname>FFI::scope</methodname>.
35+
3236
詳しくは <link linkend="ffi.examples-complete">PHP/FFI/事前ロードの完全な例</link>
3337
を参照してください。
3438
</para>
3539
<para>
36-
一つ以上の C のヘッダーファイルを同一のスコープへと事前ロードすることは可能です
40+
複数の C のヘッダーファイルを同一のスコープへと事前ロードできます
3741
</para>
3842
</section>
3943
<!-- }}} -->

reference/ffi/ffi/arraytype.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<!-- $Revision$ -->
33
<!-- EN-Revision: 9e0804888ae46a50f28d98514a8d5e70a34e069c Maintainer: nsfisis Status: working -->
44

5-
!!!
65
<refentry xml:id="ffi.arraytype" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
76
<refnamediv>
87
<refname>FFI::arrayType</refname>

reference/ffi/ffi/cdef.xml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727
<term><parameter>code</parameter></term>
2828
<listitem>
2929
<para>
30-
!!!
31-
A string containing a sequence of declarations in regular C language
32-
(types, structures, functions, variables, etc). Actually, this string may
33-
be copy-pasted from C header files.
30+
通常の C 言語の宣言 (型、構造体、関数、変数など) を含む文字列。
31+
実際には、この文字列は C のヘッダーファイルからコピーペーストしてきたものかもしれません。
3432
</para>
3533
<note>
3634
<para>
@@ -44,16 +42,15 @@
4442
<term><parameter>lib</parameter></term>
4543
<listitem>
4644
<para>
47-
!!!
48-
The name of a shared library file, to be loaded and linked with the
49-
definitions.
45+
共有ライブラリの名前。
46+
ここで指定したライブラリが読み込まれ、与えた定義とリンクされます。
5047
</para>
5148
<note>
5249
<para>
53-
!!!
54-
If <parameter>lib</parameter> is omitted or &null;, platforms supporting <literal>RTLD_DEFAULT</literal>
55-
attempt to lookup symbols declared in <parameter>code</parameter> in the normal global
56-
scope. Other systems will fail to resolve these symbols.
50+
<parameter>lib</parameter> を省略したり &null; を渡したりすると、
51+
<literal>RTLD_DEFAULT</literal> をサポートしているプラットフォームでは、
52+
通常のグローバルスコープから <parameter>code</parameter> で宣言されているシンボルを探索しようとします。
53+
そうでないシステムでは、シンボルの解決に失敗します。
5754
</para>
5855
</note>
5956
</listitem>

reference/ffi/ffi/load.xml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
</methodsynopsis>
1717
<para>
1818
C のヘッダーファイルから C の宣言を読み込みます。
19-
!!!
20-
Loads C declarations from a C header file. It is possible to specify shared libraries that should be loaded,
21-
using special <literal>FFI_LIB</literal> defines in the loaded C header file.
19+
読み込まれる C のヘッダーファイル内で特殊な define <literal>FFI_LIB</literal> を使うことで、
20+
読み込む共有ライブラリを指定することが可能です。
2221
</para>
2322
</refsect1>
2423

@@ -34,21 +33,20 @@
3433
<para>
3534
C のプリプロセッサーディレクティブはサポートされていません。
3635
例えば、<code>#include</code> や <code>#define</code>、プリプロセッサーマクロは動作しません。
37-
ただし、次に列挙する特殊な場合を除きます
36+
ただし、次に挙げる特殊な場合を除きます
3837
</para>
3938
<para>
40-
!!!
41-
The header file <emphasis>should</emphasis> contain a <literal>#define</literal> statement for the
42-
<literal>FFI_SCOPE</literal> variable, e.g.: <code>#define FFI_SCOPE "MYLIB"</code>.
43-
詳しくは <link linkend="ffi.intro">class introduction</link> を参照してください。
39+
このヘッダーファイルでは、<literal>#define</literal> 文で
40+
<literal>FFI_SCOPE</literal> 変数を定義<emphasis>すべき</emphasis>です
41+
(例: <code>#define FFI_SCOPE "MYLIB"</code>)。
42+
詳しくは <link linkend="ffi.intro">FFI クラスの概要</link> を参照してください。
4443
</para>
4544
<para>
46-
!!!
47-
The header file <emphasis>may</emphasis> contain a <literal>#define</literal> statement for the
48-
<literal>FFI_LIB</literal> variable to specify the library it exposes. If it is
49-
a system library only the file name is required, e.g.: <code>#define FFI_LIB
50-
"libc.so.6"</code>. If it is a custom library, a relative path is required,
51-
e.g.: <code>#define FFI_LIB "./mylib.so"</code>.
45+
このヘッダーファイルでは、<literal>#define</literal> 文で
46+
<literal>FFI_LIB</literal> 変数を定義することで、公開するライブラリを指定<emphasis>しても構いません</emphasis>。
47+
それがシステムライブラリなら、必要なのはファイル名だけです (例: <code>#define FFI_LIB
48+
"libc.so.6"</code>)。カスタムライブラリなら、相対パスが必要です
49+
(例: <code>#define FFI_LIB "./mylib.so"</code>)。
5250
</para>
5351
</listitem>
5452
</varlistentry>
@@ -77,11 +75,10 @@
7775
<row>
7876
<entry>8.3.0</entry>
7977
<entry>
80-
!!!
81-
<methodname>FFI::load</methodname> is now allowed in
82-
<link linkend="opcache.preloading">preload scripts</link> when the
83-
current system user is the same as the one defined in the
84-
<literal>opcache.preload_user</literal> configuration directive.
78+
現在のシステムユーザが <literal>opcache.preload_user</literal>
79+
設定ディレクティブで定義されたユーザと同じである場合、
80+
<link linkend="opcache.preloading">事前ロードスクリプト</link> の中で
81+
<methodname>FFI::load</methodname> を呼べるようになりました。
8582
</entry>
8683
</row>
8784
</tbody>

0 commit comments

Comments
 (0)