@@ -59,14 +59,16 @@ msgstr ""
59
59
msgid ""
60
60
"So, if you want to define a new extension type, you need to create a new "
61
61
"type object."
62
- msgstr ""
62
+ msgstr "それなので、新しい拡張の型を定義したいときは、新しい型オブジェクトを作成すればよいわけです。 "
63
63
64
64
#: ../../extending/newtypes_tutorial.rst:38
65
65
msgid ""
66
66
"This sort of thing can only be explained by example, so here's a minimal, "
67
67
"but complete, module that defines a new type named :class:`Custom` inside a "
68
68
"C extension module :mod:`custom`:"
69
69
msgstr ""
70
+ "この手のことは例を見たほうが早いでしょうから、以下に C 拡張モジュール :mod:`custom`: にある :class:`Custom` "
71
+ "という名前の新しい型を定義する、最小限ながら完全なモジュールをあげておきます:"
70
72
71
73
#: ../../extending/newtypes_tutorial.rst:43
72
74
msgid ""
@@ -75,35 +77,45 @@ msgid ""
75
77
"allows defining heap-allocated extension types using the "
76
78
":c:func:`PyType_FromSpec` function, which isn't covered in this tutorial."
77
79
msgstr ""
80
+ "ここで紹介している例は、 *静的な* 拡張の型を定義する伝統的な実装方法です。\n"
81
+ "これはほとんどの場面で十分なものなのです。\n"
82
+ "C API では、 :c:func:`PyType_FromSpec` 関数を使い、ヒープ上に配置された拡張の型も定義できますが、これについてはこのチュートリアルでは扱いません。"
78
83
79
84
#: ../../extending/newtypes_tutorial.rst:50
80
85
msgid ""
81
86
"Now that's quite a bit to take in at once, but hopefully bits will seem "
82
87
"familiar from the previous chapter. This file defines three things:"
83
88
msgstr ""
89
+ "一度に把握するにはちょっと量が多いですが、前の章よりはとっつきやすくなっていることと重います。このファイルでは、3つの要素が定義されています:"
84
90
85
91
#: ../../extending/newtypes_tutorial.rst:53
86
92
msgid ""
87
93
"What a :class:`Custom` **object** contains: this is the ``CustomObject`` "
88
94
"struct, which is allocated once for each :class:`Custom` instance."
89
95
msgstr ""
96
+ ":class:`Custom` **オブジェクト** が何を含んでいるか: これが ``CustomObject`` 構造体で、 "
97
+ ":class:`Custom` インスタンスごとに1回だけメモリ確保が行われます。"
90
98
91
99
#: ../../extending/newtypes_tutorial.rst:55
92
100
msgid ""
93
101
"How the :class:`Custom` **type** behaves: this is the ``CustomType`` struct,"
94
102
" which defines a set of flags and function pointers that the interpreter "
95
103
"inspects when specific operations are requested."
96
104
msgstr ""
105
+ ":class:`Custom` **型** がどのように振る舞うか: これが ``CustomType`` "
106
+ "構造体で、フラグと関数ポインタの集まりを定義しています。特定の操作が要求されたときに、この関数ポインタをインタプリタが見に行きます。"
97
107
98
108
#: ../../extending/newtypes_tutorial.rst:58
99
109
msgid ""
100
110
"How to initialize the :mod:`custom` module: this is the ``PyInit_custom`` "
101
111
"function and the associated ``custommodule`` struct."
102
112
msgstr ""
113
+ ":mod:`custom` モジュールをどう初期化するか: これが ``PyInit_custom`` 関数とそれに関係する "
114
+ "``custommodule`` 構造体です。"
103
115
104
116
#: ../../extending/newtypes_tutorial.rst:61
105
117
msgid "The first bit is::"
106
- msgstr ""
118
+ msgstr "まず最初はこれです:: "
107
119
108
120
#: ../../extending/newtypes_tutorial.rst:67
109
121
msgid ""
@@ -114,6 +126,9 @@ msgid ""
114
126
" and :c:macro:`Py_TYPE` respectively). The reason for the macro is to "
115
127
"abstract away the layout and to enable additional fields in debug builds."
116
128
msgstr ""
129
+ "これが Custom オブジェクトの内容です。\n"
130
+ "``PyObject_HEAD`` はそれぞれのオブジェクト構造体の先頭に必須なもので、 :c:type:`PyObject` 型の ``ob_base`` という名前のフィールドを定義します。 :c:type:`PyObject` 型には (それぞれ :c:macro:`Py_REFCNT` マクロおよび :c:macro:`Py_TYPE` マクロからアクセスできる) 型オブジェクトへのポインタと参照カウントが格納されています。\n"
131
+ "このマクロが用意されている理由は、構造体のレイアウトを抽象化し、デバッグビルドでフィールドを追加できるようにするためです。"
117
132
118
133
#: ../../extending/newtypes_tutorial.rst:75
119
134
msgid ""
0 commit comments