fujimoto Mon Dec 10 10:16:34 2001 EDT
Modified files:
/phpdoc/ja/appendices migration.xml migration4.xml phpdevel.xml
Log:
fixed typo, enclosed programlisting with CDATA and added the role attribute.
Index: phpdoc/ja/appendices/migration.xml
diff -u phpdoc/ja/appendices/migration.xml:1.6 phpdoc/ja/appendices/migration.xml:1.7
--- phpdoc/ja/appendices/migration.xml:1.6 Sun Dec 9 22:10:13 2001
+++ phpdoc/ja/appendices/migration.xml Mon Dec 10 10:16:32 2001
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<appendix id="migration">
<title>PHP/FI 2.0 から PHP 3.0 への移行</title>
@@ -248,7 +248,7 @@
</section>
<section id="migration.truefalse">
- <title>関数の &true;/false 返り値</title>
+ <title>関数の &true;/&false; 返り値</title>
<simpara>
ほとんどの内部関数が書き直されたのに伴い、PHP/FI 2.0
では成功時に
0 、失敗時に -1 を返していたのが、それぞれ &true; と &false;
を返す
@@ -269,7 +269,7 @@
if ($fp == -1);
echo("$file
を読み込み専用として開くことが出来ませんでした<br>\n");
endif;
-]]|
+]]>
</programlisting>
</example>
<example>
Index: phpdoc/ja/appendices/migration4.xml
diff -u phpdoc/ja/appendices/migration4.xml:1.7 phpdoc/ja/appendices/migration4.xml:1.8
--- phpdoc/ja/appendices/migration4.xml:1.7 Sun Dec 9 21:42:38 2001
+++ phpdoc/ja/appendices/migration4.xml Mon Dec 10 10:16:33 2001
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<appendix id="migration4">
<title>PHP 3.0からPHP 4.0への移行</title>
@@ -49,7 +49,7 @@
必要なリンク拡張(--enable-versioning)を指定します。それ以外の場合、
通常の命令が使用されます。例えば、
<informalexample>
- <programlisting>
+ <programlisting role="configure">
<![CDATA[
$ ./configure \
--with-apxs=/apache/bin/apxs \
@@ -72,7 +72,7 @@
Apache設定ファイルの場合、変更点はやや多くなっています。PHPモジュー
ルにより認識されるMIME型が変更となりました。
<informalexample>
- <programlisting>
+ <programlisting role="apache">
<![CDATA[
application/x-httpd-php3 --> application/x-httpd-php
application/x-httpd-php3-source --> application/x-httpd-php-source
@@ -85,7 +85,7 @@
ンに基づき)両方のバージョンで動作する設定ファイルを作成することが
可能です。
<informalexample>
- <programlisting>
+ <programlisting role="apache">
<![CDATA[
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .php3s
Index: phpdoc/ja/appendices/phpdevel.xml
diff -u phpdoc/ja/appendices/phpdevel.xml:1.7 phpdoc/ja/appendices/phpdevel.xml:1.8
--- phpdoc/ja/appendices/phpdevel.xml:1.7 Wed Nov 14 17:55:18 2001
+++ phpdoc/ja/appendices/phpdevel.xml Mon Dec 10 10:16:33 2001
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.8 $ -->
<appendix id="phpdevel">
<title>PHP の開発</title>
@@ -10,10 +11,12 @@
<title>関数プロトタイプ</title>
<para>
全ての関数は次のような形式です。
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
void php3_foo(INTERNAL_FUNCTION_PARAMETERS) {
}
+]]>
</programlisting>
関数が引数を取らない場合でも、このような形式でコールされます。
</para>
@@ -30,11 +33,13 @@
<para>
<example>
<title>引数の取得</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval *arg1, *arg2;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
WRONG_PARAM_COUNT;
}
+]]>
</programlisting>
</example>
@@ -72,7 +77,8 @@
<para>
<example>
<title>可変引数</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval *arg1, *arg2, *arg3;
int arg_count = ARG_COUNT(ht);
@@ -80,6 +86,7 @@
getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
WRONG_PARAM_COUNT;
}
+]]>
</programlisting>
</example>
</para>
@@ -140,12 +147,14 @@
その引数を強制的にある型で使用したい場合、
次の変換関数のどれかを使用することができます。
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
convert_to_long(arg1);
convert_to_double(arg1);
convert_to_string(arg1);
convert_to_boolean_long(arg1); /* 文字列が "" または "0" の場合
0、その他の場合 1 になります */
convert_string_to_number(arg1); /* 文字列に応じて値を LONG または DOUBLE
に変更します */
+]]>
</programlisting>
</para>
<simpara>
@@ -258,16 +267,20 @@
<para>
<example>
<title>$foo
がシンボルテーブルに存在するかどうかを調べる</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
else { doesn't exist }
+]]>
</programlisting>
</example>
<example>
<title>シンボルテーブルにある変数のサイズの調べ方</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
check(pvalue.type);
+]]>
</programlisting>
</example>
PHP 3.0
における配列は、シンボルテーブルと同じくハッシュテーブル
@@ -290,11 +303,13 @@
<para>
<example>
<title>新規の配列の初期化</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval arr;
if (array_init(&arr) == FAILURE) { failed... };
hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
+]]>
</programlisting>
</example>
このコードは、アクティブシンボルテーブルにおいて新規配列を宣言しています。
@@ -306,7 +321,8 @@
<para>
<example>
<title>新規配列にエントリを加える</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval entry;
entry.type = IS_LONG;
@@ -322,6 +338,7 @@
* (php2 と同様に動作します)
*/
hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL);
+]]>
</programlisting>
</example>
@@ -342,26 +359,32 @@
関数から配列を返す構成とする場合、
以下のようにするだけで配列の初期化を行うことができます。
</simpara>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
if (array_init(return_value) == FAILURE) { failed...; }
+]]>
</programlisting>
<simpara>
続いて、ヘルパー関数を用いて値を付加します。
</simpara>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
add_next_index_long(return_value,long_value);
add_next_index_double(return_value,double_value);
add_next_index_string(return_value,estrdup(string_value));
+]]>
</programlisting>
<para>
もちろん、付加が配列の初期化直後に行われない場合には、
配列をまず確認する必要があることでしょう。
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval *arr;
if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) {
can't find... }
else { use arr->value.ht... }
+]]>
</programlisting>
</para>
<simpara>
@@ -458,8 +481,10 @@
あります。これは、基本的に通常のハッシュテーブルです。
(すなわち、.value.ht に通常のハッシュ関数が使用可能です)
実際の関数の登録は、次のようにして実行できます。
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
add_method( return_value, function_name, function_ptr );
+]]>
</programlisting>
</para>
</listitem>
@@ -550,19 +575,22 @@
<para>
<example>
<title>新規リソースの追加</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
RESOURCE *resource;
/* ...リソース用のメモリを確保し、リソースを獲得します... */
/* 新規のリソースをリストに追加します */
return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
return_value->type = IS_LONG;
+]]>
</programlisting>
</example>
<example>
<title>既存のリソースの使用法</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval *resource_id;
RESOURCE *resource;
int type;
@@ -574,18 +602,21 @@
RETURN_FALSE;
}
/* ...リソースを使用します... */
+]]>
</programlisting>
</example>
<example>
<title>既存のリソースの削除</title>
- <programlisting>
+ <programlisting role="c">
+<![CDATA[
pval *resource_id;
RESOURCE *resource;
int type;
convert_to_long(resource_id);
php3_list_delete(resource_id->value.lval);
+]]>
</programlisting>
</example>
リソース型は php3_list.h の enum list_entry_type
にて登録する必要が