|
13 | 13 | <section xml:id="ffi-cdata.intro"> |
14 | 14 | &reftitle.intro; |
15 | 15 | <para> |
16 | | - !!! |
17 | | - <classname>FFI\CData</classname> objects can be used in a number of ways as a regular |
| 16 | + <classname>FFI\CData</classname> オブジェクトは、通常の PHP データのように様々な方法で使用できます: |
18 | 17 |
|
19 | | - PHP data: |
20 | 18 | <itemizedlist> |
21 | 19 | <listitem> |
22 | 20 | <simpara> |
23 | | - !!! |
24 | | - C data of scalar types can be read and assigned via the <property>$cdata</property> property, e.g. |
| 21 | + スカラー型の C のデータは <property>$cdata</property> プロパティを通してアクセスできます。例: |
25 | 22 | <code>$x = FFI::new('int'); $x->cdata = 42;</code> |
26 | 23 | </simpara> |
27 | 24 | </listitem> |
28 | 25 | <listitem> |
29 | 26 | <simpara> |
30 | | - !!! |
31 | | - C struct and union fields can be accessed as regular PHP object property, e.g. |
| 27 | + C の構造体や共用体のフィールドは通常の PHP のオブジェクトプロパティのようにアクセスできます。例: |
32 | 28 | <code>$cdata->field</code> |
33 | 29 | </simpara> |
34 | 30 | </listitem> |
35 | 31 | <listitem> |
36 | 32 | <simpara> |
37 | | - !!! |
38 | | - C array elements can be accessed as regular PHP array elements, e.g. |
| 33 | + C の配列要素は通常の PHP の配列要素のようにアクセスできます。例: |
39 | 34 | <code>$cdata[$offset]</code> |
40 | 35 | </simpara> |
41 | 36 | </listitem> |
42 | 37 | <listitem> |
43 | 38 | <simpara> |
44 | | - !!! |
45 | | - C arrays can be iterated using &foreach; statements. |
| 39 | + C の配列は &foreach; 文を使って反復できます。 |
46 | 40 | </simpara> |
47 | 41 | </listitem> |
48 | 42 | <listitem> |
49 | 43 | <simpara> |
50 | | - !!! |
51 | | - C arrays can be used as arguments of <function>count</function>. |
| 44 | + C の配列は <function>count</function> の引数として使えます。 |
52 | 45 | </simpara> |
53 | 46 | </listitem> |
54 | 47 | <listitem> |
55 | 48 | <simpara> |
56 | | - !!! |
57 | | - C pointers can be dereferenced as arrays, e.g. <code>$cdata[0]</code> |
| 49 | + !!! dereference |
| 50 | + C のポインタは配列のように dereference できます。例: <code>$cdata[0]</code> |
58 | 51 | </simpara> |
59 | 52 | </listitem> |
60 | 53 | <listitem> |
61 | 54 | <simpara> |
62 | | - !!! |
63 | | - C pointers can be compared using regular comparison operators (<code><</code>, |
64 | | - <code><=</code>, <code>==</code>, <code>!=</code>, <code>>=</code>, <code>></code>). |
| 55 | + C のポインタは通常の比較演算子を使って比較できます (<code><</code>、 |
| 56 | + <code><=</code>、<code>==</code>、<code>!=</code>、<code>>=</code>、<code>></code>)。 |
65 | 57 | </simpara> |
66 | 58 | </listitem> |
67 | 59 | <listitem> |
68 | 60 | <simpara> |
69 | | - !!! |
70 | | - C pointers can be incremented and decremented using regular <code>+</code>/<code>-</code>/ |
71 | | - <code>++</code>/<code>--</code> operations, e.g. <code>$cdata += 5</code> |
| 61 | + C のポインタは通常の <code>+</code>/<code>-</code>/ |
| 62 | + <code>++</code>/<code>--</code> 演算子を使ってインクリメント・デクリメントできます。例: <code>$cdata += 5</code> |
72 | 63 | </simpara> |
73 | 64 | </listitem> |
74 | 65 | <listitem> |
75 | 66 | <simpara> |
76 | | - !!! |
77 | | - C pointers can be subtracted from another using regular <code>-</code> operations. |
| 67 | + C のポインタは通常の <code>-</code> 演算子を使って他のポインタと引き算できます。 |
78 | 68 | </simpara> |
79 | 69 | </listitem> |
80 | 70 | <listitem> |
81 | 71 | <simpara> |
82 | | - !!! |
83 | | - C pointers to functions can be called as a regular PHP closure, e.g. <code>$cdata()</code> |
| 72 | + C の関数ポインタは通常の PHP のクロージャのように呼び出せます。例: <code>$cdata()</code> |
84 | 73 | </simpara> |
85 | 74 | </listitem> |
86 | 75 | <listitem> |
|
98 | 87 | </listitem> |
99 | 88 | <listitem> |
100 | 89 | <simpara> |
101 | | - !!! |
102 | | - <classname>FFI\CData</classname> can now be assigned to structs and fields as of PHP 8.3.0. |
| 90 | + PHP 8.3.0 以降、<classname>FFI\CData</classname> は構造体やフィールドに代入できるようになりました。 |
103 | 91 | </simpara> |
104 | 92 | </listitem> |
105 | 93 | </itemizedlist> |
|
0 commit comments