fujimoto                Sun Dec 16 05:04:35 2001 EDT

  Modified files:              
    /phpdoc/ja/language functions.xml oop.xml 
  Log:
  updated translation.
  
  
Index: phpdoc/ja/language/functions.xml
diff -u phpdoc/ja/language/functions.xml:1.8 phpdoc/ja/language/functions.xml:1.9
--- phpdoc/ja/language/functions.xml:1.8        Wed Dec 12 15:54:00 2001
+++ phpdoc/ja/language/functions.xml    Sun Dec 16 05:04:35 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.9 $ -->
  <chapter id="functions">
   <title>関数</title>
   
@@ -10,10 +11,13 @@
  
     <informalexample>
      <programlisting role="php">
-function foo ($arg_1, $arg_2, ..., $arg_n) {
+<![CDATA[
+function foo ($arg_1, $arg_2, ..., $arg_n)
+{
     echo "関数の例\n";
     return $retval;
 }
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -75,9 +79,11 @@
  
     <informalexample>
      <programlisting role="php">
+<![CDATA[
 function takes_array($input) {
     echo "$input[0] + $input[1] = ", $input[0]+$input[1];
 }
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -97,12 +103,14 @@
      
      <informalexample>
       <programlisting role="php">
-function add_some_extra(&amp;$string) {
+<![CDATA[
+function add_some_extra(&$string) {
     $string .= 'and something extra.';
 }
 $str = 'This is a string, ';
 add_some_extra($str);
 echo $str;    // 'This is a string, and something extra.' を出力します
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -113,14 +121,16 @@
      
      <informalexample>
       <programlisting role="php">
+<![CDATA[
 function foo ($bar) {
     $bar .= ' and something extra.';
 }
 $str = 'This is a string, ';
 foo ($str);
 echo $str;    // 'This is a string, ' を出力します。
-foo (&amp;$str);
+foo (&$str);
 echo $str;    // 'This is a string, and something extra.' を出力します。
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -136,11 +146,14 @@
      
      <informalexample>
       <programlisting role="php">
-function makecoffee ($type = "cappucino") {
+<![CDATA[
+function makecoffee ($type = "cappucino")
+{
     return "一杯の $type を作ります\n";
 }
 echo makecoffee ();
 echo makecoffee ("espresso");
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -166,11 +179,14 @@
  
       <informalexample>
        <programlisting role="php">
-function makeyogurt ($type = "acidophilus", $flavour) {
+<![CDATA[
+function makeyogurt ($type = "acidophilus", $flavour)
+{
     return "Making a bowl of $type $flavour.\n";
 }
  
 echo makeyogurt ("raspberry");   // 期待通りには動作しません
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -190,11 +206,14 @@
      
      <informalexample>
       <programlisting role="php">
-function makeyogurt ($flavour, $type = "acidophilus") {
+<![CDATA[
+function makeyogurt ($flavour, $type = "acidophilus")
+{
     return "Making a bowl of $type $flavour.\n";
 }
  
 echo makeyogurt ("raspberry");   // 期待通りに動作します
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -238,10 +257,13 @@
     
     <informalexample>
      <programlisting role="php">
-function square ($num) {
+<![CDATA[
+function square ($num)
+{
     return $num * $num;
 }
 echo square (4);   // '16' を出力します。
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -251,10 +273,13 @@
  
     <informalexample>
      <programlisting role="php">
-function small_numbers() {
+<![CDATA[
+function small_numbers()
+{
     return array (0, 1, 2);
 }
 list ($zero, $one, $two) = small_numbers();
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -263,11 +288,14 @@
     
言部および変数への返り値を代入する際の両方で使用する必要があります。
     <informalexample>
      <programlisting role="php">
-function &amp;returns_reference() {
+<![CDATA[
+function &returns_reference()
+{
     return $someref;
 }
 
-$newref =&amp;returns_reference();
+$newref =& returns_reference();
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -320,20 +348,23 @@
     <example>
      <title>可変関数の例</title>
      <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
 function foo() {
-   echo "In foo()&lt;br>\n";
+    echo "In foo()<br>\n";
 }
  
-function bar( $arg = '' ) {
-   echo "In bar(); argument was '$arg'.&lt;br>\n";
+function bar($arg = '')
+{
+    echo "In bar(); argument was '$arg'.<br>\n";
 }
  
 $func = 'foo';
 $func();
 $func = 'bar';
-$func( 'test' );
+$func('test');
 ?>
+]]>
      </programlisting>
     </example>
    </para>
Index: phpdoc/ja/language/oop.xml
diff -u phpdoc/ja/language/oop.xml:1.13 phpdoc/ja/language/oop.xml:1.14
--- phpdoc/ja/language/oop.xml:1.13     Wed Dec 12 15:54:01 2001
+++ phpdoc/ja/language/oop.xml  Sun Dec 16 05:04:35 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.14 $ -->
  <chapter id="language.oop">
   <title>クラスとオブジェクト</title>
 
@@ -10,19 +11,23 @@
  
      <informalexample>
       <programlisting role="php">
-&lt;?php
-class Cart {
+<![CDATA[
+<?php
+class Cart
+{
     var $items;  // 買い物篭の中のアイテム
    
     // $num 個の $artnr を買い物篭に加えます
  
-    function add_item ($artnr, $num) {
+       function add_item ($artnr, $num)
+       {
         $this->items[$artnr] += $num;
     }
    
     // $num 個の $artnr を買い物籠から出します
  
-    function remove_item ($artnr, $num) {
+       function remove_item ($artnr, $num)
+       {
         if ($this->items[$artnr] > $num) {
             $this->items[$artnr] -= $num;
             return true;
@@ -31,7 +36,8 @@
         }   
     }
 }
-?&gt;
+?>
+]]>
      </programlisting>
     </informalexample>
    </para>
@@ -75,8 +81,10 @@
     </simpara>
     <informalexample>
      <programlisting role="php">
+<![CDATA[
 /* 以下のコードはPHP 4では動作しません。 */
-class Cart {
+class Cart
+{
     var $todays_date = date("Y-m-d");
     var $name = $firstname;
     var $owner = 'Fred ' . 'Jones';
@@ -84,18 +92,21 @@
 }
 
 /* 以下に正しい方法を示します。 */
-class Cart {
+class Cart
+{
     var $todays_date;
     var $name;
     var $owner;
     var $items;
 
-    function Cart() {
+       function Cart()
+       {
         $this->todays_date = date("Y-m-d");
         $this->name = $GLOBALS['firstname'];
         /* 等など. . . */
     }
 }
+]]>
      </programlisting>
     </informalexample>
    </note>
@@ -106,11 +117,15 @@
  
    <informalexample>
     <programlisting role="php">
+<![CDATA[
+<?php
   $cart = new Cart;
   $cart->add_item("10", 1);
 
   $another_cart = new Cart;
   $another_cart->add_item("0815", 3);
+?>
+]]>
     </programlisting>
    </informalexample>
  
@@ -139,6 +154,7 @@
 
    <informalexample>
     <programlisting role="php">
+<![CDATA[
 // 正しい、$は一つ
 $cart->items  = array("10" => 1); 
 
@@ -146,9 +162,10 @@
 $cart->$items = array("10" => 1);
 
 // 正しいが、意図しているかどうかによらず、
-// $cart->$myvar は、 $ncart->items となる
+// $cart->$myvar は、 $cart->items となる
 $myvar = 'items';
 $cart->$myvar = array("10" => 1); 
+]]>
     </programlisting>
    </informalexample>
 
@@ -160,7 +177,7 @@
     
きないのです。代わりに、クラスの中からそのクラス内の関数や変数にア
     クセスするために、疑似変数 $this 
を使用することが可能です。$this
     
は、「自分自身の」または「カレントのオブジェクト」と読み変えること
-    ができます。つまり、'$this->items[$artnr] += $num' は、「同じクラ
+    ができます。つまり、'$this-&gt;items[$artnr] += $num' 
+は、「同じクラ
     ス内の配列 items の $artnr カウンタに $num 
を追加する」または「カ
     レントオブジェクト内の配列 items の $artnr カウンタに $num 
を追加
     する」と読み変えることが可能です。
@@ -186,13 +203,17 @@
 
    <informalexample>
     <programlisting role="php">
-class Named_Cart extends Cart {
+<![CDATA[
+class Named_Cart extends Cart
+{
     var $owner;
   
-    function set_owner ($name) {
+       function set_owner ($name)
+       {
         $this->owner = $name;
     }
 }
+]]>
     </programlisting>
    </informalexample>
  
@@ -206,10 +227,12 @@
  
    <informalexample>
     <programlisting role="php">
+<![CDATA[
 $ncart = new Named_Cart;    // 名前付きの籠を作成
-$ncart->set_owner ("kris"); // 籠の所有者の名前を設定
+$ncart->set_owner("kris");  // 籠の所有者の名前を設定
 print $ncart->owner;        // 籠の所有者を出力
-$ncart->add_item ("10", 1); // (籠から継承された機能)
+$ncart->add_item("10", 1);  // (籠から継承された機能)
+]]>
     </programlisting>
    </informalexample>
   
@@ -237,12 +260,16 @@
    
    <informalexample>
     <programlisting role="php">
+<![CDATA[
 // PHP 3 および PHP 4で動作します
-class Auto_Cart extends Cart {
-    function Auto_Cart () {
-        $this->add_item ("10", 1);
+class Auto_Cart extends Cart
+{
+    function Auto_Cart ()
+    {
+        $this->add_item("10", 1);
     }
 }
+]]>
     </programlisting>
    </informalexample>
  
@@ -258,20 +285,24 @@
  
    <informalexample>
     <programlisting role="php">
+<![CDATA[
 // PHP 3 と PHP 4の両方で動作
-class Constructor_Cart extends Cart {
-    function Constructor_Cart ($item = "10", $num = 1) {
-        $this->add_item ($item, $num);
+class Constructor_Cart extends Cart
+{
+    function Constructor_Cart ($item = "10", $num = 1)
+    {
+        $this->add_item($item, $num);
     }
 }
  
 // しつこいが、前の例と同じものを買う
  
-$default_cart   = new Constructor_Cart;
+$default_cart = new Constructor_Cart;
  
 // 実際に買うもの篭に入れる...
  
-$different_cart = new Constructor_Cart ("20", 17);
+$different_cart = new Constructor_Cart("20", 17);
+]]>
     </programlisting>
    </informalexample>
 
@@ -284,20 +315,26 @@
    
    <informalexample>
     <programlisting role="php">
-class A {
-  function A() {
-    echo "Aのコンストラクタです&lt;br>\n";
-  }
+<![CDATA[
+class A
+{
+    function A()
+    {
+        echo "Aのコンストラクタです&lt;br>\n";
+    }
 }
 
-class B extends A {
-  function C() {
-    "通常の関数&lt;br>\n";
-  }
+class B extends A
+{
+    function C()
+    {
+        "通常の関数<br>\n";
+    }
 }
 
 // PHP 3ではコンストラクタはコールされません
 $b = new B;
+]]>
     </programlisting>
    </informalexample>
 
@@ -317,25 +354,32 @@
 
    <informalexample>
     <programlisting role="php">
-class A {
-  function A() {
-    echo "Aのコンストラクタです&lt;br>\n";
-  }
-  
-  function B() {
-    echo "クラスAのBという名前の通常の関数&lt;br>\n";
-    echo "Aのコンストラクタではありません&lt;br>\n";
-  }
+<![CDATA[
+class A
+{
+    function A()
+    {
+        echo "Aのコンストラクタです&lt;br>\n";
+    }
+
+    function B()
+    {
+        echo "クラスAのBという名前の通常の関数&lt;br>\n";
+        echo "Aのコンストラクタではありません&lt;br>\n";
+    }
 }
 
-class B extends A {
-  function C() {
-    echo "通常の関数です&lt;br>\n";
-  }
+class B extends A
+{
+    function C()
+    {
+        echo "通常の関数です&lt;br>\n";
+    }
 }
 
 // これにより、B() がコンストラクタとしてコールされます。
 $b = new B;
+]]>
     </programlisting>
    </informalexample>
    
@@ -371,8 +415,8 @@
    </note>
    
    <para>
-    
デストラクタは、<function>unset</function>または変数のスコープから
-    
でることにより、変数が破棄される度に自動的にコールされる関数です。
+    デストラクタは、<function>unset</function>またはスコープから
+    
+でることにより、オブジェクトが破棄される度に自動的にコールされる関数です。
     PHPにはデストラクタはありません。
    </para>
   </sect1>
@@ -394,21 +438,26 @@
    
    <informalexample>
     <programlisting role="php">
-class A {
-  function example() {
-    echo "オリジナルの関数A::example().&lt;br>\n";
-  }
+<![CDATA[
+class A
+{
+    function example()
+    {
+       echo "オリジナルの関数A::example().<br>\n";
+    }
 }
 
-class B extends A {
-  function example() {
-    echo "再定義された関数B::example().&lt;br>\n";
-    A::example();
-  }
+class B extends A
+{
+    function example()
+    {
+        echo "再定義された関数B::example().<br>\n";
+        A::example();
+    }
 }
 
 // クラスAのオブジェクトはありません
-// この例は、「オリジナルの関数A::example().&lt;br>」を出力しま
+// この例は、「オリジナルの関数A::example().<br>」を出力しま
 // す
 A::example();
 
@@ -416,9 +465,10 @@
 $b = new B;
 
 // この例の出力は次のようになります。
-//   再定義された関数B::example().&lt;br>
-//   オリジナルの関数A::example().&lt;br>
+//   再定義された関数B::example().<br>
+//   オリジナルの関数A::example().<br>
 $b->example();
+]]>
     </programlisting>
    </informalexample>
 
@@ -474,23 +524,29 @@
 
    <informalexample>
     <programlisting role="php">
-class A {
-  function example() {
-    echo "A::example()です。基本関数を提供します。&lt;br>\n";
-  }
+<![CDATA[
+class A
+{
+    function example()
+    {
+        echo "A::example()です。基本関数を提供します。&lt;br>\n";
+    }
 }
 
-class B extends A {
-  function example() {
-    echo "B::example()です。付加的な機能を提供します。&lt;br>\n";
-    parent::example();
-  }
+class B extends A
+{
+    function example()
+    {
+        echo "B::example()です。付加的な機能を提供します。<br>\n";
+        parent::example();
+    } 
 }
 
 $b = new B;
      
 // 
B::example()をコールし、この関数の中からA::example()がコールされます。
 $b->example();
+]]>
     </programlisting>
    </informalexample>
   </sect1>
@@ -536,13 +592,16 @@
    
    <informalexample>
     <programlisting role="php">
+<![CDATA[
 classa.inc:
-  class A {
-    var $one = 1;
-    
-    function show_one() {
-      echo $this->one;
-    }
+  class A
+  {
+      var $one = 1;
+      
+      function show_one()
+      {
+          echo $this->one;
+      }
   }
   
 page1.php:
@@ -560,10 +619,11 @@
   include("classa.inc");
 
   $s = implode("", @file("store"));
-  unserialize($s);
+  $a = unserialize($s);
 
-  // オブジェクト$aの関数show_oneを使用する
+  // オブジェクト$aの関数show_one()を使用する
   $a->show_one();
+]]>
     </programlisting>
    </informalexample>
   
@@ -636,26 +696,31 @@
     
     <informalexample>
      <programlisting role="php">
-
-class foo {
-    function foo($name) {
+<![CDATA[
+class foo
+{
+    function foo($name)
+    {
         // 内部への参照グローバル配列 $globalref を作成
         global $globalref;
-       $globalref[] = &amp;$this;
+        $globalref[] = &$this;
         // name を指定した値に設定
         $this->setName($name);
-       // それを出力
+        // それを出力
         $this->echoName();
     }
 
-    function echoName() {
-        echo "&lt;br&gt;",$this->Name;
+    function echoName()
+    {
+        echo "<br>",$this->Name;
     }
        
-    function setName($name)    {
-       $this->Name = $name;
+    function setName($name)
+    {
+        $this->Name = $name;
     }
 }
+]]>
     </programlisting>
    </informalexample>
   </para>
@@ -668,25 +733,25 @@
 
     <informalexample>
      <programlisting role="php">
-   
-    $bar1 = new foo('set in constructor');
-    $bar1->echoName();
-    $globalref[0]->echoName();
-    
-    /* 出力:
-    set in constructor
-    set in constructor
-    set in constructor */
-    
-    $bar2 =&amp; new foo('set in constructor');
-    $bar2->echoName();
-    $globalref[1]->echoName();
-
-    /* 出力:
-    set in constructor
-    set in constructor
-    set in constructor */
-    
+<![CDATA[
+$bar1 = new foo('set in constructor');
+$bar1->echoName();
+$globalref[0]->echoName();
+
+/* 出力:
+set in constructor
+set in constructor
+set in constructor */
+
+$bar2 =& new foo('set in constructor');
+$bar2->echoName();
+$globalref[1]->echoName();
+
+/* 出力:
+set in constructor
+set in constructor
+set in constructor */
+]]>    
      </programlisting>
     </informalexample>
    </para>
@@ -709,8 +774,9 @@
     </note>
     
上記の記述が正しいことを示すために以下のコードを見てみましょう。
 
-   <informalexample>
+    <informalexample>
      <programlisting role="php">
+<![CDATA[
 // ここで、name を変更してみます。どうなるでしょうか?
 // $bar と $globalref[0] 
の両方共名前が変わると予想するかもしれません...
 $bar1->setName('set from outside');
@@ -733,8 +799,8 @@
 /* 出力: 
    set from outside 
    set from outside */
-        
-      </programlisting>
+]]>        
+     </programlisting>
     </informalexample>   
    </para>   
    <para>
@@ -742,39 +808,43 @@
     
     <informalexample>
      <programlisting role="php">
-      
-class a {
-    function a($i) {
-       $this->value = $i;
-       // ここで参照を使う必要がない理由を考えてみて下さい
-       $this->b = new b($this);
+<![CDATA[      
+class A
+{
+    function A($i)
+    {
+        $this->value = $i;
+        // ここで参照を使う必要がない理由を考えてみて下さい
+        $this->b = new B($this);
     }
 
-    function createRef() {
-        $this->c = new b($this);
+    function createRef()
+    {
+        $this->c = new B($this);
     }
 
-    function echoValue() {
-        echo "&lt;br&gt;","class ",get_class($this),': ',$this->value;
-        }
+    function echoValue()
+    {
+        echo "<br>","class ",get_class($this),': ',$this->value;
+    }
 }
 
-
-class b  {
-
-    function b(&amp;$a) {
-        $this->a = &amp;$a;
+class B
+{
+    function B(&$a)
+    {
+        $this->a = &$a;
     }
 
-   function echoValue() {
-        echo "&lt;br&gt;","class ",get_class($this),': ',$this->a->value;
-        }
-
+    function echoValue()
+    {
+        echo "<br>","class ",get_class($this),': ',$this->a->value;
+    }
 }
 
 // 以下の単純なコピーが、* 
印を付けた行で望ましくない結果を生む理由を
 // 考えてみて下さい。
-$a =&amp; new a(10);
+$a =& new A(10);
 $a->createRef();
 
 $a->echoValue();
@@ -789,13 +859,14 @@
 
 /*
 出力:
-class a: 10
-class b: 10
-class b: 10
-class a: 11
-class b: 11
-class b: 11
+class A: 10
+class B: 10
+class B: 10
+class A: 11
+class B: 11
+class B: 11
 */
+]]>
      </programlisting>
     </informalexample>
    </para>


Reply via email to