@@ -59,14 +59,16 @@ msgstr ""
5959msgid ""
6060"So, if you want to define a new extension type, you need to create a new "
6161"type object."
62- msgstr ""
62+ msgstr "それなので、新しい拡張の型を定義したいときは、新しい型オブジェクトを作成すればよいわけです。 "
6363
6464#: ../../extending/newtypes_tutorial.rst:38
6565msgid ""
6666"This sort of thing can only be explained by example, so here's a minimal, "
6767"but complete, module that defines a new type named :class:`Custom` inside a "
6868"C extension module :mod:`custom`:"
6969msgstr ""
70+ "この手のことは例を見たほうが早いでしょうから、以下に C 拡張モジュール :mod:`custom`: にある :class:`Custom` "
71+ "という名前の新しい型を定義する、最小限ながら完全なモジュールをあげておきます:"
7072
7173#: ../../extending/newtypes_tutorial.rst:43
7274msgid ""
@@ -75,35 +77,45 @@ msgid ""
7577"allows defining heap-allocated extension types using the "
7678":c:func:`PyType_FromSpec` function, which isn't covered in this tutorial."
7779msgstr ""
80+ "ここで紹介している例は、 *静的な* 拡張の型を定義する伝統的な実装方法です。\n"
81+ "これはほとんどの場面で十分なものなのです。\n"
82+ "C API では、 :c:func:`PyType_FromSpec` 関数を使い、ヒープ上に配置された拡張の型も定義できますが、これについてはこのチュートリアルでは扱いません。"
7883
7984#: ../../extending/newtypes_tutorial.rst:50
8085msgid ""
8186"Now that's quite a bit to take in at once, but hopefully bits will seem "
8287"familiar from the previous chapter. This file defines three things:"
8388msgstr ""
89+ "一度に把握するにはちょっと量が多いですが、前の章よりはとっつきやすくなっていることと重います。このファイルでは、3つの要素が定義されています:"
8490
8591#: ../../extending/newtypes_tutorial.rst:53
8692msgid ""
8793"What a :class:`Custom` **object** contains: this is the ``CustomObject`` "
8894"struct, which is allocated once for each :class:`Custom` instance."
8995msgstr ""
96+ ":class:`Custom` **オブジェクト** が何を含んでいるか: これが ``CustomObject`` 構造体で、 "
97+ ":class:`Custom` インスタンスごとに1回だけメモリ確保が行われます。"
9098
9199#: ../../extending/newtypes_tutorial.rst:55
92100msgid ""
93101"How the :class:`Custom` **type** behaves: this is the ``CustomType`` struct,"
94102" which defines a set of flags and function pointers that the interpreter "
95103"inspects when specific operations are requested."
96104msgstr ""
105+ ":class:`Custom` **型** がどのように振る舞うか: これが ``CustomType`` "
106+ "構造体で、フラグと関数ポインタの集まりを定義しています。特定の操作が要求されたときに、この関数ポインタをインタプリタが見に行きます。"
97107
98108#: ../../extending/newtypes_tutorial.rst:58
99109msgid ""
100110"How to initialize the :mod:`custom` module: this is the ``PyInit_custom`` "
101111"function and the associated ``custommodule`` struct."
102112msgstr ""
113+ ":mod:`custom` モジュールをどう初期化するか: これが ``PyInit_custom`` 関数とそれに関係する "
114+ "``custommodule`` 構造体です。"
103115
104116#: ../../extending/newtypes_tutorial.rst:61
105117msgid "The first bit is::"
106- msgstr ""
118+ msgstr "まず最初はこれです:: "
107119
108120#: ../../extending/newtypes_tutorial.rst:67
109121msgid ""
@@ -114,6 +126,9 @@ msgid ""
114126" and :c:macro:`Py_TYPE` respectively). The reason for the macro is to "
115127"abstract away the layout and to enable additional fields in debug builds."
116128msgstr ""
129+ "これが Custom オブジェクトの内容です。\n"
130+ "``PyObject_HEAD`` はそれぞれのオブジェクト構造体の先頭に必須なもので、 :c:type:`PyObject` 型の ``ob_base`` という名前のフィールドを定義します。 :c:type:`PyObject` 型には (それぞれ :c:macro:`Py_REFCNT` マクロおよび :c:macro:`Py_TYPE` マクロからアクセスできる) 型オブジェクトへのポインタと参照カウントが格納されています。\n"
131+ "このマクロが用意されている理由は、構造体のレイアウトを抽象化し、デバッグビルドでフィールドを追加できるようにするためです。"
117132
118133#: ../../extending/newtypes_tutorial.rst:75
119134msgid ""
0 commit comments