-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathctypes.po
More file actions
3377 lines (2969 loc) · 165 KB
/
ctypes.po
File metadata and controls
3377 lines (2969 loc) · 165 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 1990-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# tomo, 2017
# 秘湯 <xwhhsprings@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Python 2.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 01:01+0900\n"
"PO-Revision-Date: 2019-09-01 05:22+0000\n"
"Last-Translator: tomo\n"
"Language-Team: Japanese (http://www.transifex.com/python-doc/python-27/"
"language/ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/ctypes.rst:2
msgid ":mod:`ctypes` --- A foreign function library for Python"
msgstr ":mod:`ctypes` --- Pythonのための外部関数ライブラリ"
#: ../../library/ctypes.rst:11
msgid ""
":mod:`ctypes` is a foreign function library for Python. It provides C "
"compatible data types, and allows calling functions in DLLs or shared "
"libraries. It can be used to wrap these libraries in pure Python."
msgstr ""
":mod:`ctypes` は Python のための外部関数ライブラリです。このライブラリは C と"
"互換性のあるデータ型を提供し、動的リンク/共有ライブラリ内の関数呼び出しを可能"
"にします。動的リンク/共有ライブラリを純粋な Python でラップするために使うこと"
"ができます。"
#: ../../library/ctypes.rst:19
msgid "ctypes tutorial"
msgstr "ctypesチュートリアル"
#: ../../library/ctypes.rst:21
msgid ""
"Note: The code samples in this tutorial use :mod:`doctest` to make sure that "
"they actually work. Since some code samples behave differently under Linux, "
"Windows, or Mac OS X, they contain doctest directives in comments."
msgstr ""
"注意: このチュートリアルのコードサンプルは動作確認のために :mod:`doctest` を"
"使います。コードサンプルの中には Linux、 Windows、あるいは Mac OS X 上で異な"
"る動作をするものがあるため、サンプルのコメントに doctest 命令を入れてありま"
"す。"
#: ../../library/ctypes.rst:25
msgid ""
"Note: Some code samples reference the ctypes :class:`c_int` type. This type "
"is an alias for the :class:`c_long` type on 32-bit systems. So, you should "
"not be confused if :class:`c_long` is printed if you would expect :class:"
"`c_int` --- they are actually the same type."
msgstr ""
"注意: いくつかのコードサンプルで ctypes の :class:`c_int` 型を参照していま"
"す。 32 ビットシステムにおいてこの型は :class:`c_long` 型のエイリアスです。そ"
"のため、 :class:`c_int` 型を想定しているときに :class:`c_long` が表示されたと"
"しても、混乱しないようにしてください --- 実際には同じ型なのです。"
#: ../../library/ctypes.rst:34
msgid "Loading dynamic link libraries"
msgstr "動的リンクライブラリをロードする"
#: ../../library/ctypes.rst:36
msgid ""
":mod:`ctypes` exports the *cdll*, and on Windows *windll* and *oledll* "
"objects, for loading dynamic link libraries."
msgstr ""
"動的リンクライブラリをロードするために、 :mod:`ctypes` は *cdll* をエクスポー"
"トします。 Windows では *windll* と *oledll* オブジェクトをエクスポートしま"
"す。"
#: ../../library/ctypes.rst:39
msgid ""
"You load libraries by accessing them as attributes of these objects. *cdll* "
"loads libraries which export functions using the standard ``cdecl`` calling "
"convention, while *windll* libraries call functions using the ``stdcall`` "
"calling convention. *oledll* also uses the ``stdcall`` calling convention, "
"and assumes the functions return a Windows :c:type:`HRESULT` error code. The "
"error code is used to automatically raise a :class:`WindowsError` exception "
"when the function call fails."
msgstr ""
"これらのオブジェクトの属性としてライブラリにアクセスすることでライブラリを"
"ロードします。 *cdll* は標準 ``cdecl`` 呼び出し規約を用いて関数をエクスポート"
"しているライブラリをロードします。それに対して、 *windll* ライブラリは "
"``stdcall`` 呼び出し規約を用いる関数を呼び出します。 *oledll* も ``stdcall`` "
"呼び出し規約を使いますが、関数が Windows :c:type:`HRESULT` エラーコードを返す"
"ことを想定しています。このエラーコードは関数呼び出しが失敗したとき、 :class:"
"`WindowsError` 例外を自動的に送出させるために使われます。"
#: ../../library/ctypes.rst:47
msgid ""
"Here are some examples for Windows. Note that ``msvcrt`` is the MS standard "
"C library containing most standard C functions, and uses the cdecl calling "
"convention::"
msgstr ""
"Windows用の例ですが、 ``msvcrt`` はほとんどの標準 C 関数が含まれている MS 標"
"準 C ライブラリであり、 cdecl 呼び出し規約を使うことに注意してください::"
#: ../../library/ctypes.rst:59
msgid "Windows appends the usual ``.dll`` file suffix automatically."
msgstr "Windows では通常の ``.dll`` ファイル拡張子を自動的に追加します。"
#: ../../library/ctypes.rst:61
msgid ""
"On Linux, it is required to specify the filename *including* the extension "
"to load a library, so attribute access can not be used to load libraries. "
"Either the :meth:`LoadLibrary` method of the dll loaders should be used, or "
"you should load the library by creating an instance of CDLL by calling the "
"constructor::"
msgstr ""
"Linux ではライブラリをロードするために拡張子を *含む* ファイル名を指定する必"
"要があるので、ロードしたライブラリに対する属性アクセスはできません。 dll ロー"
"ダーの :meth:`LoadLibrary` メソッドを使うか、コンストラクタを呼び出して CDLL "
"のインスタンスを作ることでライブラリをロードするかのどちらかを行わなければな"
"りません::"
#: ../../library/ctypes.rst:79
msgid "Accessing functions from loaded dlls"
msgstr "ロードしたdllから関数にアクセスする"
#: ../../library/ctypes.rst:81
msgid "Functions are accessed as attributes of dll objects::"
msgstr "dll オブジェクトの属性として関数にアクセスします::"
#: ../../library/ctypes.rst:96
msgid ""
"Note that win32 system dlls like ``kernel32`` and ``user32`` often export "
"ANSI as well as UNICODE versions of a function. The UNICODE version is "
"exported with an ``W`` appended to the name, while the ANSI version is "
"exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` "
"function, which returns a *module handle* for a given module name, has the "
"following C prototype, and a macro is used to expose one of them as "
"``GetModuleHandle`` depending on whether UNICODE is defined or not::"
msgstr ""
"``kernel32`` や ``user32`` のような win32 システム dll は、多くの場合関数の "
"UNICODE バージョンに加えて ANSI バージョンもエクスポートすることに注意してく"
"ださい。 UNICODE バージョンは後ろに ``W`` が付いた名前でエクスポートされ、 "
"ANSI バージョンは ``A`` が付いた名前でエクスポートされます。与えられたモ"
"ジュールの *モジュールハンドル* を返す win32 ``GetModuleHandle`` 関数は次のよ"
"うな C プロトタイプを持ちます。 UNICODE バージョンが定義されているかどうかに"
"より ``GetModuleHandle`` としてどちらか一つを公開するためにマクロが使われま"
"す::"
#: ../../library/ctypes.rst:109
msgid ""
"*windll* does not try to select one of them by magic, you must access the "
"version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` "
"explicitly, and then call it with strings or unicode strings respectively."
msgstr ""
"*windll* は魔法を使ってどちらか一つを選ぶようなことはしません。 "
"``GetModuleHandleA`` もしくは ``GetModuleHandleW`` を明示的に指定して必要とす"
"るバージョンにアクセスし、文字列か Unicode 文字列を使ってそれぞれ呼び出さなけ"
"ればなりません。"
#: ../../library/ctypes.rst:114
msgid ""
"Sometimes, dlls export functions with names which aren't valid Python "
"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:"
"`getattr` to retrieve the function::"
msgstr ""
"時には、 dll が関数を ``\"??2@YAPAXI@Z\"`` のような Python 識別子として有効で"
"ない名前でエクスポートすることがあります。このような場合に関数を取り出すに"
"は、 :func:`getattr` を使わなければなりません。::"
#: ../../library/ctypes.rst:122
msgid ""
"On Windows, some dlls export functions not by name but by ordinal. These "
"functions can be accessed by indexing the dll object with the ordinal "
"number::"
msgstr ""
"Windows では、名前ではなく序数によって関数をエクスポートする dll もあります。"
"こうした関数には序数を使って dll オブジェクトにインデックス指定することでアク"
"セスします::"
#: ../../library/ctypes.rst:139
msgid "Calling functions"
msgstr "関数を呼び出す"
#: ../../library/ctypes.rst:141
msgid ""
"You can call these functions like any other Python callable. This example "
"uses the ``time()`` function, which returns system time in seconds since the "
"Unix epoch, and the ``GetModuleHandleA()`` function, which returns a win32 "
"module handle."
msgstr ""
"これらの関数は他の Python 呼び出し可能オブジェクトと同じように呼び出すことが"
"できます。この例では ``time()`` 関数 (Unixエポックからのシステム時間を秒単位"
"で返す) と、 ``GetModuleHandleA()`` 関数 (win32モジュールハンドルを返す) を使"
"います。"
#: ../../library/ctypes.rst:146
msgid ""
"This example calls both functions with a NULL pointer (``None`` should be "
"used as the NULL pointer)::"
msgstr ""
"この例は両方の関数を NULL ポインタとともに呼び出します (``None`` を NULL ポイ"
"ンタとして使う必要があります)::"
#: ../../library/ctypes.rst:155
msgid ""
":mod:`ctypes` tries to protect you from calling functions with the wrong "
"number of arguments or the wrong calling convention. Unfortunately this "
"only works on Windows. It does this by examining the stack after the "
"function returns, so although an error is raised the function *has* been "
"called::"
msgstr ""
":mod:`ctypes` は引数の数を間違えたり、あるいは呼び出し規約を間違えた関数呼び"
"出しからあなたを守ろうとします。残念ながら、これは Windows でしか機能しませ"
"ん。関数が返った後にスタックを調べることでこれを行います。したがって、エラー"
"は発生しますが、その関数は呼び出された *後です*::"
#: ../../library/ctypes.rst:170
msgid ""
"The same exception is raised when you call an ``stdcall`` function with the "
"``cdecl`` calling convention, or vice versa::"
msgstr ""
"同じ例外が ``cdecl`` 呼び出し規約を使って ``stdcall`` 関数を呼び出したときに"
"送出されますし、逆の場合も同様です。::"
#: ../../library/ctypes.rst:185
msgid ""
"To find out the correct calling convention you have to look into the C "
"header file or the documentation for the function you want to call."
msgstr ""
"正しい呼び出し規約を知るためには、呼び出したい関数についての C ヘッダファイル"
"もしくはドキュメントを見なければなりません。"
#: ../../library/ctypes.rst:188
msgid ""
"On Windows, :mod:`ctypes` uses win32 structured exception handling to "
"prevent crashes from general protection faults when functions are called "
"with invalid argument values::"
msgstr ""
"Windows では、関数が無効な引数とともに呼び出された場合の一般保護例外によるク"
"ラッシュを防ぐために、 :mod:`ctypes` は win32 構造化例外処理を使います::"
#: ../../library/ctypes.rst:198
msgid ""
"There are, however, enough ways to crash Python with :mod:`ctypes`, so you "
"should be careful anyway."
msgstr ""
"しかし、 :mod:`ctypes` を使って Python をクラッシュさせる方法は十分なほどある"
"ので、よく注意すべきです。"
#: ../../library/ctypes.rst:201
msgid ""
"``None``, integers, longs, byte strings and unicode strings are the only "
"native Python objects that can directly be used as parameters in these "
"function calls. ``None`` is passed as a C ``NULL`` pointer, byte strings and "
"unicode strings are passed as pointer to the memory block that contains "
"their data (:c:type:`char *` or :c:type:`wchar_t *`). Python integers and "
"Python longs are passed as the platforms default C :c:type:`int` type, their "
"value is masked to fit into the C type."
msgstr ""
"``None`` 、整数、長整数、バイト文字列および Unicode 文字列だけが、こうした関"
"数呼び出しにおいてパラメータとして直接使えるネイティブの Python オブジェクト"
"です。 ``None`` は C の ``NULL`` ポインタとして渡され、バイト文字列と "
"Unicode 文字列はそのデータを含むメモリブロックへのポインタ (:c:type:`char *` "
"または :c:type:`wchar_t *`) として渡されます。 Python 整数と Python 長整数は"
"プラットフォームのデフォルトの C :c:type:`int` 型として渡され、その値は C :c:"
"type:`int` 型に合うようにマスクされます。"
#: ../../library/ctypes.rst:209
msgid ""
"Before we move on calling functions with other parameter types, we have to "
"learn more about :mod:`ctypes` data types."
msgstr ""
"他のパラメータ型をもつ関数呼び出しに移る前に、 :mod:`ctypes` データ型について"
"さらに学ぶ必要があります。"
#: ../../library/ctypes.rst:216 ../../library/ctypes.rst:2142
msgid "Fundamental data types"
msgstr "基本データ型"
#: ../../library/ctypes.rst:218
msgid ":mod:`ctypes` defines a number of primitive C compatible data types:"
msgstr ""
":mod:`ctypes` ではいくつもの C 互換のプリミティブなデータ型を定義しています:"
#: ../../library/ctypes.rst:221
msgid "ctypes type"
msgstr "ctypes の型"
#: ../../library/ctypes.rst:221
msgid "C type"
msgstr "C の型"
#: ../../library/ctypes.rst:221
msgid "Python type"
msgstr "Python の型"
#: ../../library/ctypes.rst:223
msgid ":class:`c_bool`"
msgstr ":class:`c_bool`"
#: ../../library/ctypes.rst:223
msgid ":c:type:`_Bool`"
msgstr ":c:type:`_Bool`"
#: ../../library/ctypes.rst:223
msgid "bool (1)"
msgstr "bool (1)"
#: ../../library/ctypes.rst:225
msgid ":class:`c_char`"
msgstr ":class:`c_char`"
#: ../../library/ctypes.rst:225 ../../library/ctypes.rst:229
msgid ":c:type:`char`"
msgstr ":c:type:`char`"
#: ../../library/ctypes.rst:225
msgid "1-character string"
msgstr "1文字の文字列"
#: ../../library/ctypes.rst:227
msgid ":class:`c_wchar`"
msgstr ":class:`c_wchar`"
#: ../../library/ctypes.rst:227
msgid ":c:type:`wchar_t`"
msgstr ":c:type:`wchar_t`"
#: ../../library/ctypes.rst:227
msgid "1-character unicode string"
msgstr "1文字の Unicode 文字列"
#: ../../library/ctypes.rst:229
msgid ":class:`c_byte`"
msgstr ":class:`c_byte`"
#: ../../library/ctypes.rst:229 ../../library/ctypes.rst:231
#: ../../library/ctypes.rst:233 ../../library/ctypes.rst:235
#: ../../library/ctypes.rst:237 ../../library/ctypes.rst:239
#: ../../library/ctypes.rst:241 ../../library/ctypes.rst:243
#: ../../library/ctypes.rst:245 ../../library/ctypes.rst:247
msgid "int/long"
msgstr "整数/長整数"
#: ../../library/ctypes.rst:231
msgid ":class:`c_ubyte`"
msgstr ":class:`c_ubyte`"
#: ../../library/ctypes.rst:231
msgid ":c:type:`unsigned char`"
msgstr ":c:type:`unsigned char`"
#: ../../library/ctypes.rst:233
msgid ":class:`c_short`"
msgstr ":class:`c_short`"
#: ../../library/ctypes.rst:233
msgid ":c:type:`short`"
msgstr ":c:type:`short`"
#: ../../library/ctypes.rst:235
msgid ":class:`c_ushort`"
msgstr ":class:`c_ushort`"
#: ../../library/ctypes.rst:235
msgid ":c:type:`unsigned short`"
msgstr ":c:type:`unsigned short`"
#: ../../library/ctypes.rst:237
msgid ":class:`c_int`"
msgstr ":class:`c_int`"
#: ../../library/ctypes.rst:237
msgid ":c:type:`int`"
msgstr ":c:type:`int`"
#: ../../library/ctypes.rst:239
msgid ":class:`c_uint`"
msgstr ":class:`c_uint`"
#: ../../library/ctypes.rst:239
msgid ":c:type:`unsigned int`"
msgstr ":c:type:`unsigned int`"
#: ../../library/ctypes.rst:241
msgid ":class:`c_long`"
msgstr ":class:`c_long`"
#: ../../library/ctypes.rst:241
msgid ":c:type:`long`"
msgstr ":c:type:`long`"
#: ../../library/ctypes.rst:243
msgid ":class:`c_ulong`"
msgstr ":class:`c_ulong`"
#: ../../library/ctypes.rst:243
msgid ":c:type:`unsigned long`"
msgstr ":c:type:`unsigned long`"
#: ../../library/ctypes.rst:245
msgid ":class:`c_longlong`"
msgstr ":class:`c_longlong`"
#: ../../library/ctypes.rst:245
msgid ":c:type:`__int64` or :c:type:`long long`"
msgstr ":c:type:`__int64` または :c:type:`long long`"
#: ../../library/ctypes.rst:247
msgid ":class:`c_ulonglong`"
msgstr ":class:`c_ulonglong`"
#: ../../library/ctypes.rst:247
msgid ":c:type:`unsigned __int64` or :c:type:`unsigned long long`"
msgstr ":c:type:`unsigned __int64` または :c:type:`unsigned long long`"
#: ../../library/ctypes.rst:250
msgid ":class:`c_float`"
msgstr ":class:`c_float`"
#: ../../library/ctypes.rst:250
msgid ":c:type:`float`"
msgstr ":c:type:`float`"
#: ../../library/ctypes.rst:250 ../../library/ctypes.rst:252
#: ../../library/ctypes.rst:254
msgid "float"
msgstr "浮動小数点数"
#: ../../library/ctypes.rst:252
msgid ":class:`c_double`"
msgstr ":class:`c_double`"
#: ../../library/ctypes.rst:252
msgid ":c:type:`double`"
msgstr ":c:type:`double`"
#: ../../library/ctypes.rst:254
msgid ":class:`c_longdouble`"
msgstr ":class:`c_longdouble`"
#: ../../library/ctypes.rst:254
msgid ":c:type:`long double`"
msgstr ":c:type:`long double`"
#: ../../library/ctypes.rst:256
msgid ":class:`c_char_p`"
msgstr ":class:`c_char_p`"
#: ../../library/ctypes.rst:256
msgid ":c:type:`char *` (NUL terminated)"
msgstr ":c:type:`char *` (NUL 終端)"
#: ../../library/ctypes.rst:256
msgid "string or ``None``"
msgstr "文字列または ``None``"
#: ../../library/ctypes.rst:258
msgid ":class:`c_wchar_p`"
msgstr ":class:`c_wchar_p`"
#: ../../library/ctypes.rst:258
msgid ":c:type:`wchar_t *` (NUL terminated)"
msgstr ":c:type:`wchar_t *` (NUL 終端)"
#: ../../library/ctypes.rst:258
msgid "unicode or ``None``"
msgstr "Unicode または ``None``"
#: ../../library/ctypes.rst:260
msgid ":class:`c_void_p`"
msgstr ":class:`c_void_p`"
#: ../../library/ctypes.rst:260
msgid ":c:type:`void *`"
msgstr ":c:type:`void *`"
#: ../../library/ctypes.rst:260
msgid "int/long or ``None``"
msgstr "整数/長整数または ``None``"
#: ../../library/ctypes.rst:264
msgid "The constructor accepts any object with a truth value."
msgstr "コンストラクタは任意のオブジェクトをその真偽値として受け取ります。"
#: ../../library/ctypes.rst:266
msgid ""
"All these types can be created by calling them with an optional initializer "
"of the correct type and value::"
msgstr ""
"これら全ての型はその型を呼び出すことによって作成でき、オプションとして型と値"
"が合っている初期化子を指定することができます::"
#: ../../library/ctypes.rst:277
msgid ""
"Since these types are mutable, their value can also be changed afterwards::"
msgstr "これらの型は変更可能であり、値を後で変更することもできます::"
#: ../../library/ctypes.rst:289
msgid ""
"Assigning a new value to instances of the pointer types :class:`c_char_p`, :"
"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they "
"point to, *not the contents* of the memory block (of course not, because "
"Python strings are immutable)::"
msgstr ""
"新しい値をポインタ型 :class:`c_char_p`, :class:`c_wchar_p` および :class:"
"`c_void_p` のインスタンスへ代入すると、変わるのは指している *メモリ位置* で"
"あって、メモリブロックの *内容ではありません* (これは当然で、なぜなら、 "
"Python 文字列は変更不可能だからです)::"
#: ../../library/ctypes.rst:305
msgid ""
"You should be careful, however, not to pass them to functions expecting "
"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :"
"func:`create_string_buffer` function which creates these in various ways. "
"The current memory block contents can be accessed (or changed) with the "
"``raw`` property; if you want to access it as NUL terminated string, use the "
"``value`` property::"
msgstr ""
"しかし、変更可能なメモリを指すポインタであることを想定している関数へそれらを"
"渡さないように注意すべきです。もし変更可能なメモリブロックが必要なら、 "
"ctypes には :func:`create_string_buffer` 関数があり、いろいろな方法で作成する"
"ことできます。現在のメモリブロックの内容は ``raw`` プロパティを使ってアクセ"
"ス (あるいは変更) することができます。もし現在のメモリブロックに NUL 終端文字"
"列としてアクセスしたいなら、 ``value`` プロパティを使ってください::"
#: ../../library/ctypes.rst:329
msgid ""
"The :func:`create_string_buffer` function replaces the :func:`c_buffer` "
"function (which is still available as an alias), as well as the :func:"
"`c_string` function from earlier ctypes releases. To create a mutable "
"memory block containing unicode characters of the C type :c:type:`wchar_t` "
"use the :func:`create_unicode_buffer` function."
msgstr ""
":func:`create_string_buffer` 関数は初期の ctypes リリースにあった :func:"
"`c_string` 関数だけでなく、 (エイリアスとしてはまだ利用できる) :func:"
"`c_buffer` 関数をも置き換えるものです。 C の型 :c:type:`wchar_t` の Unicode "
"文字を含む変更可能なメモリブロックを作成するには、 :func:"
"`create_unicode_buffer` 関数を使ってください。"
#: ../../library/ctypes.rst:339
msgid "Calling functions, continued"
msgstr "続・関数を呼び出す"
#: ../../library/ctypes.rst:341
msgid ""
"Note that printf prints to the real standard output channel, *not* to :data:"
"`sys.stdout`, so these examples will only work at the console prompt, not "
"from within *IDLE* or *PythonWin*::"
msgstr ""
"printf は :data:`sys.stdout` では *なく* 、本物の標準出力チャンネルへプリント"
"することに注意してください。したがって、これらの例はコンソールプロンプトでの"
"み動作し、 *IDLE* や *PythonWin* では動作しません。::"
#: ../../library/ctypes.rst:361
msgid ""
"As has been mentioned before, all Python types except integers, strings, and "
"unicode strings have to be wrapped in their corresponding :mod:`ctypes` "
"type, so that they can be converted to the required C data type::"
msgstr ""
"前に述べたように、必要な C のデータ型へ変換できるようにするためには、整数、文"
"字列および Unicode 文字列を除くすべての Python 型を対応する :mod:`ctypes` 型"
"でラップしなければなりません。::"
#: ../../library/ctypes.rst:374
msgid "Calling functions with your own custom data types"
msgstr "自作のデータ型とともに関数を呼び出す"
#: ../../library/ctypes.rst:376
msgid ""
"You can also customize :mod:`ctypes` argument conversion to allow instances "
"of your own classes be used as function arguments. :mod:`ctypes` looks for "
"an :attr:`_as_parameter_` attribute and uses this as the function argument. "
"Of course, it must be one of integer, string, or unicode::"
msgstr ""
"自作のクラスのインスタンスを関数引数として使えるように、 :mod:`ctypes` 引数変"
"換をカスタマイズすることもできます。 :mod:`ctypes` は :attr:`_as_parameter_` "
"属性を探し出し、関数引数として使います。もちろん、整数、文字列もしくは "
"Unicode の中の一つでなければなりません。::"
#: ../../library/ctypes.rst:391
msgid ""
"If you don't want to store the instance's data in the :attr:`_as_parameter_` "
"instance variable, you could define a :func:`property` which makes the data "
"available."
msgstr ""
"インスタンスのデータを :attr:`_as_parameter_` インスタンス変数の中に入れたく"
"ない場合には、そのデータを利用できるようにする :func:`property` を定義するこ"
"とができます。"
#: ../../library/ctypes.rst:399
msgid "Specifying the required argument types (function prototypes)"
msgstr "要求される引数の型を指定する (関数プロトタイプ)"
#: ../../library/ctypes.rst:401
msgid ""
"It is possible to specify the required argument types of functions exported "
"from DLLs by setting the :attr:`argtypes` attribute."
msgstr ""
":attr:`argtypes` 属性を設定することによって、 DLL からエクスポートされている"
"関数に要求される引数の型を指定することができます。"
#: ../../library/ctypes.rst:404
msgid ""
":attr:`argtypes` must be a sequence of C data types (the ``printf`` function "
"is probably not a good example here, because it takes a variable number and "
"different types of parameters depending on the format string, on the other "
"hand this is quite handy to experiment with this feature)::"
msgstr ""
":attr:`argtypes` は C データ型のシーケンスでなければなりません (この場合 "
"``printf`` 関数はおそらく良い例ではありません。なぜなら、引数の数が可変であ"
"り、フォーマット文字列に依存した異なる型のパラメータを取るからです。一方で"
"は、この機能の実験にはとても便利です)。::"
#: ../../library/ctypes.rst:415
msgid ""
"Specifying a format protects against incompatible argument types (just as a "
"prototype for a C function), and tries to convert the arguments to valid "
"types::"
msgstr ""
"(C の関数のプロトタイプのように) 書式を指定すると互換性のない引数型になるのを"
"防ぎ、引数を有効な型へ変換しようとします。::"
#: ../../library/ctypes.rst:427
msgid ""
"If you have defined your own classes which you pass to function calls, you "
"have to implement a :meth:`from_param` class method for them to be able to "
"use them in the :attr:`argtypes` sequence. The :meth:`from_param` class "
"method receives the Python object passed to the function call, it should do "
"a typecheck or whatever is needed to make sure this object is acceptable, "
"and then return the object itself, its :attr:`_as_parameter_` attribute, or "
"whatever you want to pass as the C function argument in this case. Again, "
"the result should be an integer, string, unicode, a :mod:`ctypes` instance, "
"or an object with an :attr:`_as_parameter_` attribute."
msgstr ""
"関数呼び出しへ渡す自作のクラスを定義した場合には、 :attr:`argtypes` シーケン"
"スの中で使えるようにするために、そのクラスに :meth:`from_param` クラスメソッ"
"ドを実装しなければなりません。 :meth:`from_param` クラスメソッドは関数呼び出"
"しへ渡された Python オブジェクトを受け取り、型チェックもしくはこのオブジェク"
"トが受け入れ可能であると確かめるために必要なことはすべて行ってから、オブジェ"
"クト自身、 :attr:`_as_parameter_` 属性、あるいは、この場合に C 関数引数として"
"渡したい何かの値を返さなければなりません。繰り返しになりますが、その返される"
"結果は整数、文字列、 Unicode 、 :mod:`ctypes` インスタンス、あるいは :attr:"
"`_as_parameter_` 属性をもつオブジェクトであるべきです。"
#: ../../library/ctypes.rst:441
msgid "Return types"
msgstr "戻り値の型"
#: ../../library/ctypes.rst:443
msgid ""
"By default functions are assumed to return the C :c:type:`int` type. Other "
"return types can be specified by setting the :attr:`restype` attribute of "
"the function object."
msgstr ""
"デフォルトでは、関数は C :c:type:`int` を返すと仮定されます。他の戻り値の型を"
"指定するには、関数オブジェクトの :attr:`restype` 属性に設定します。"
#: ../../library/ctypes.rst:447
msgid ""
"Here is a more advanced example, it uses the ``strchr`` function, which "
"expects a string pointer and a char, and returns a pointer to a string::"
msgstr ""
"さらに高度な例として、 ``strchr`` 関数を使います。この関数は文字列ポインタと "
"char を受け取り、文字列へのポインタを返します。::"
#: ../../library/ctypes.rst:460
msgid ""
"If you want to avoid the ``ord(\"x\")`` calls above, you can set the :attr:"
"`argtypes` attribute, and the second argument will be converted from a "
"single character Python string into a C char::"
msgstr ""
"上の ``ord(\"x\")`` 呼び出しを避けたいなら、 :attr:`argtypes` 属性を設定する"
"ことができます。二番目の引数が一文字の Python 文字列から C の char へ変換され"
"ます。::"
#: ../../library/ctypes.rst:478
msgid ""
"You can also use a callable Python object (a function or a class for "
"example) as the :attr:`restype` attribute, if the foreign function returns "
"an integer. The callable will be called with the *integer* the C function "
"returns, and the result of this call will be used as the result of your "
"function call. This is useful to check for error return values and "
"automatically raise an exception::"
msgstr ""
"外部関数が整数を返す場合は、 :attr:`restype` 属性として呼び出し可能な Python "
"オブジェクト (例えば、関数またはクラス) を使うこともできます。呼び出し可能オ"
"ブジェクトは C 関数が返す *整数* とともに呼び出され、この呼び出しの結果は関数"
"呼び出しの結果として使われるでしょう。これはエラーの戻り値をチェックして自動"
"的に例外を送出させるために役に立ちます。::"
#: ../../library/ctypes.rst:501
msgid ""
"``WinError`` is a function which will call Windows ``FormatMessage()`` api "
"to get the string representation of an error code, and *returns* an "
"exception. ``WinError`` takes an optional error code parameter, if no one is "
"used, it calls :func:`GetLastError` to retrieve it."
msgstr ""
"``WinError`` はエラーコードの文字列表現を得るために Windows の "
"``FormatMessage()`` api を呼び出し、例外を *返す* 関数です。 ``WinError`` は"
"オプションでエラーコードパラメータを取ります。このパラメータが使われない場合"
"は、エラーコードを取り出すために :func:`GetLastError` を呼び出します。"
#: ../../library/ctypes.rst:506
msgid ""
"Please note that a much more powerful error checking mechanism is available "
"through the :attr:`errcheck` attribute; see the reference manual for details."
msgstr ""
":attr:`errcheck` 属性によってもっと強力なエラーチェック機構を利用できることに"
"注意してください。詳細はリファレンスマニュアルを参照してください。"
#: ../../library/ctypes.rst:513
msgid "Passing pointers (or: passing parameters by reference)"
msgstr "ポインタを渡す(または、パラメータの参照渡し)"
#: ../../library/ctypes.rst:515
msgid ""
"Sometimes a C api function expects a *pointer* to a data type as parameter, "
"probably to write into the corresponding location, or if the data is too "
"large to be passed by value. This is also known as *passing parameters by "
"reference*."
msgstr ""
"時には、 C api 関数がパラメータのデータ型として *ポインタ* を想定していること"
"があります。おそらくパラメータと同一の場所に書き込むためか、もしくはそのデー"
"タが大きすぎて値渡しできない場合です。これは *パラメータの参照渡し* としても"
"知られています。"
#: ../../library/ctypes.rst:519
msgid ""
":mod:`ctypes` exports the :func:`byref` function which is used to pass "
"parameters by reference. The same effect can be achieved with the :func:"
"`pointer` function, although :func:`pointer` does a lot more work since it "
"constructs a real pointer object, so it is faster to use :func:`byref` if "
"you don't need the pointer object in Python itself::"
msgstr ""
":mod:`ctypes` は :func:`byref` 関数をエクスポートしており、パラメータを参照渡"
"しするために使用します。 :func:`pointer` 関数を使っても同じ効果が得られます。"
"しかし、 :func:`pointer` は本当のポインタオブジェクトを構築するためより多くの"
"処理を行うことから、 Python 側でポインタオブジェクト自体を必要としないなら"
"ば :func:`byref` を使う方がより高速です。::"
#: ../../library/ctypes.rst:541
msgid "Structures and unions"
msgstr "構造体と共用体"
#: ../../library/ctypes.rst:543
msgid ""
"Structures and unions must derive from the :class:`Structure` and :class:"
"`Union` base classes which are defined in the :mod:`ctypes` module. Each "
"subclass must define a :attr:`_fields_` attribute. :attr:`_fields_` must be "
"a list of *2-tuples*, containing a *field name* and a *field type*."
msgstr ""
"構造体と共用体は :mod:`ctypes` モジュールに定義されている :class:`Structure` "
"および :class:`Union` ベースクラスからの派生クラスでなければなりません。それ"
"ぞれのサブクラスは :attr:`_fields_` 属性を定義する必要があります。 :attr:"
"`_fields_` は *フィールド名* と *フィールド型* を持つ *2要素タプル* のリスト"
"でなければなりません。"
#: ../../library/ctypes.rst:548
msgid ""
"The field type must be a :mod:`ctypes` type like :class:`c_int`, or any "
"other derived :mod:`ctypes` type: structure, union, array, pointer."
msgstr ""
"フィールド型は :class:`c_int` か他の :mod:`ctypes` 型 (構造体、共用体、配列、"
"ポインタ) から派生した :mod:`ctypes` 型である必要があります。"
#: ../../library/ctypes.rst:551
msgid ""
"Here is a simple example of a POINT structure, which contains two integers "
"named *x* and *y*, and also shows how to initialize a structure in the "
"constructor::"
msgstr ""
"*x* と *y* という名前の二つの整数からなる簡単な POINT 構造体の例です。コンス"
"トラクタで構造体の初期化する方法の説明にもなっています。::"
#: ../../library/ctypes.rst:571
msgid ""
"You can, however, build much more complicated structures. A structure can "
"itself contain other structures by using a structure as a field type."
msgstr ""
"しかし、もっと複雑な構造体を構築することもできます。ある構造体は、他の構造体"
"をフィールド型として使うことで、他の構造体を含むことができます。"
#: ../../library/ctypes.rst:574
msgid ""
"Here is a RECT structure which contains two POINTs named *upperleft* and "
"*lowerright*::"
msgstr ""
"*upperleft* と *lowerright* という名前の二つの POINT を持つ RECT 構造体で"
"す。::"
#: ../../library/ctypes.rst:588
msgid ""
"Nested structures can also be initialized in the constructor in several "
"ways::"
msgstr ""
"入れ子になった構造体はいくつかの方法を用いてコンストラクタで初期化することが"
"できます。::"
#: ../../library/ctypes.rst:593
msgid ""
"Field :term:`descriptor`\\s can be retrieved from the *class*, they are "
"useful for debugging because they can provide useful information::"
msgstr ""
"フィールド :term:`descriptor` (記述子)は *クラス* から取り出せます。デバッグ"
"するときに役に立つ情報を得ることができます::"
#: ../../library/ctypes.rst:607
msgid ""
":mod:`ctypes` does not support passing unions or structures with bit-fields "
"to functions by value. While this may work on 32-bit x86, it's not "
"guaranteed by the library to work in the general case. Unions and "
"structures with bit-fields should always be passed to functions by pointer."
msgstr ""
":mod:`ctypes` では、ビットフィールドのある共用体や構造体の関数への値渡しはサ"
"ポートしていません。これは 32-bit の x86 環境では動くかもしれませんが、このラ"
"イブラリでは一般の場合に動作することは保証していません。"
#: ../../library/ctypes.rst:613
msgid "Structure/union alignment and byte order"
msgstr "構造体/共用体アライメントとバイトオーダー"
#: ../../library/ctypes.rst:615
msgid ""
"By default, Structure and Union fields are aligned in the same way the C "
"compiler does it. It is possible to override this behavior be specifying a :"
"attr:`_pack_` class attribute in the subclass definition. This must be set "
"to a positive integer and specifies the maximum alignment for the fields. "
"This is what ``#pragma pack(n)`` also does in MSVC."
msgstr ""
"デフォルトでは、構造体 (Structure) と共用体(Union) のフィールドは C コンパイ"
"ラが行うのと同じ方法でアライメントされています。サブクラスを定義するときに :"
"attr:`_pack_` クラス属性を指定することでこの動作を変えることは可能です。この"
"クラス属性には正の整数を設定する必要があり、フィールドの最大アライメントを指"
"定します。これは MSVC で ``#pragma pack(n)`` が行っていること同じです。"
#: ../../library/ctypes.rst:621
msgid ""
":mod:`ctypes` uses the native byte order for Structures and Unions. To "
"build structures with non-native byte order, you can use one of the :class:"
"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:"
"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These "
"classes cannot contain pointer fields."
msgstr ""
":mod:`ctypes` は Structure と Union に対してネイティブのバイトオーダーを使い"
"ます。ネイティブではないバイトオーダーの構造体を作成するには、 :class:"
"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:"
"`BigEndianUnion` および :class:`LittleEndianUnion` ベースクラスの中の一つを使"
"います。これらのクラスにポインタフィールドを持たせることはできません。"
#: ../../library/ctypes.rst:631
msgid "Bit fields in structures and unions"
msgstr "構造体と共用体におけるビットフィールド"
#: ../../library/ctypes.rst:633
msgid ""
"It is possible to create structures and unions containing bit fields. Bit "
"fields are only possible for integer fields, the bit width is specified as "
"the third item in the :attr:`_fields_` tuples::"
msgstr ""
"ビットフィールドを含む構造体と共用体を作ることができます。ビットフィールドは"
"整数フィールドに対してのみ作ることができ、ビット幅は :attr:`_fields_` タプル"
"の第三要素で指定します。::"
#: ../../library/ctypes.rst:651
msgid "Arrays"
msgstr "配列"
#: ../../library/ctypes.rst:653
msgid ""
"Arrays are sequences, containing a fixed number of instances of the same "
"type."
msgstr ""
"配列 (Array) はシーケンスであり、決まった数の同じ型のインスタンスを持ちます。"
#: ../../library/ctypes.rst:655
msgid ""
"The recommended way to create array types is by multiplying a data type with "
"a positive integer::"
msgstr "推奨されている配列の作成方法はデータ型に正の整数を掛けることです。::"
#: ../../library/ctypes.rst:660
msgid ""
"Here is an example of a somewhat artificial data type, a structure "
"containing 4 POINTs among other stuff::"
msgstr ""
"ややわざとらしいデータ型の例になりますが、他のものに混ざって 4 個の POINT が"
"ある構造体です::"
#: ../../library/ctypes.rst:676
msgid "Instances are created in the usual way, by calling the class::"
msgstr "インスタンスはクラスを呼び出す通常の方法で作成します。::"
#: ../../library/ctypes.rst:682
msgid ""
"The above code print a series of ``0 0`` lines, because the array contents "
"is initialized to zeros."
msgstr ""
"上記のコードは ``0 0`` という行が並んだものを表示します。配列の要素がゼロで初"
"期化されているためです。"
#: ../../library/ctypes.rst:685
msgid "Initializers of the correct type can also be specified::"
msgstr "正しい型の初期化子を指定することもできます。::"
#: ../../library/ctypes.rst:701
msgid "Pointers"
msgstr "ポインタ"
#: ../../library/ctypes.rst:703
msgid ""
"Pointer instances are created by calling the :func:`pointer` function on a :"
"mod:`ctypes` type::"
msgstr ""
"ポインタのインスタンスは :mod:`ctypes` 型に対して :func:`pointer` 関数を呼び"
"出して作成します。::"
#: ../../library/ctypes.rst:711
msgid ""
"Pointer instances have a :attr:`~_Pointer.contents` attribute which returns "
"the object to which the pointer points, the ``i`` object above::"
msgstr ""
"次のように、ポインタインスタンスは、ポインタが指すオブジェクト (上の例では "
"``i``) を返す :attr:`~_Pointer.contents` 属性を持ちます::"
#: ../../library/ctypes.rst:718
msgid ""
"Note that :mod:`ctypes` does not have OOR (original object return), it "
"constructs a new, equivalent object each time you retrieve an attribute::"
msgstr ""
":mod:`ctypes` は OOR (original object return 、元のオブジェクトを返すこと) で"
"はないことに注意してください。属性を取り出す度に、新しい同等のオブジェクトを"
"作成しているのです。::"
#: ../../library/ctypes.rst:727
msgid ""
"Assigning another :class:`c_int` instance to the pointer's contents "
"attribute would cause the pointer to point to the memory location where this "
"is stored::"
msgstr ""
"別の :class:`c_int` インスタンスがポインタの contents 属性に代入されると、こ"
"れが記憶されているメモリ位置を指すポインタに変化します。::"
#: ../../library/ctypes.rst:739
msgid "Pointer instances can also be indexed with integers::"
msgstr "ポインタインスタンスは整数でインデックス指定することもできます。::"
#: ../../library/ctypes.rst:745
msgid "Assigning to an integer index changes the pointed to value::"
msgstr "整数インデックスへ代入するとポインタが指す値が変更されます。::"
#: ../../library/ctypes.rst:754
msgid ""
"It is also possible to use indexes different from 0, but you must know what "
"you're doing, just as in C: You can access or change arbitrary memory "
"locations. Generally you only use this feature if you receive a pointer from "
"a C function, and you *know* that the pointer actually points to an array "
"instead of a single item."
msgstr ""
"0 ではないインデックスを使うこともできますが、 C の場合と同じように自分が何を"
"しているかを理解している必要があります。任意のメモリ位置にアクセスもしくは変"
"更できるのです。一般的にこの機能を使うのは、 C 関数からポインタを受け取り、そ"
"のポインタが単一の要素ではなく実際に配列を指していると *分かっている* 場合だ"
"けです。"
#: ../../library/ctypes.rst:760
msgid ""
"Behind the scenes, the :func:`pointer` function does more than simply create "
"pointer instances, it has to create pointer *types* first. This is done "
"with the :func:`POINTER` function, which accepts any :mod:`ctypes` type, and "
"returns a new type::"
msgstr ""
"舞台裏では、 :func:`pointer` 関数は単にポインタインスタンスを作成するという以"
"上のことを行っています。はじめにポインタ *型* を作成する必要があります。これ"
"は任意の :mod:`ctypes` 型を受け取る :func:`POINTER` 関数を使って行われ、新し"
"い型を返します。::"
#: ../../library/ctypes.rst:776
msgid ""
"Calling the pointer type without an argument creates a ``NULL`` pointer. "
"``NULL`` pointers have a ``False`` boolean value::"
msgstr ""
"ポインタ型を引数なしで呼び出すと ``NULL`` ポインタを作成します。 ``NULL`` ポ"
"インタは ``False`` ブール値を持っています。::"
#: ../../library/ctypes.rst:784
msgid ""
":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but "
"dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::"
msgstr ""
":mod:`ctypes` はポインタの指す値を取り出すときに ``NULL`` かどうかを調べます"
"(しかし、 ``NULL`` でない不正なポインタの指す値の取り出す行為は Python をク"
"ラッシュさせるでしょう)。::"
#: ../../library/ctypes.rst:803
msgid "Type conversions"
msgstr "型変換"
#: ../../library/ctypes.rst:805