1010# Zombie110year <[email protected] >, 20191111# ppcfish <[email protected] >, 20191212# ruoyu zhang <[email protected] >, 201913- # Freesand Leo <[email protected] >, 20191413# kks uch <[email protected] >, 20201514# zeroswan <[email protected] >, 202015+ # Freesand Leo <[email protected] >, 20201616#
1717#, fuzzy
1818msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121"Report-Msgid-Bugs-To : \n "
2222"POT-Creation-Date : 2020-05-31 09:25+0000\n "
2323"PO-Revision-Date : 2017-02-16 23:05+0000\n "
24- "Last-Translator : zeroswan <weditor @163.com>, 2020\n "
24+ "Last-Translator : Freesand Leo <yuqinju @163.com>, 2020\n "
2525"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2626"MIME-Version : 1.0\n "
2727"Content-Type : text/plain; charset=UTF-8\n "
@@ -692,10 +692,13 @@ msgid ""
692692"since it constructs a real pointer object, so it is faster to use "
693693":func:`byref` if you don't need the pointer object in Python itself::"
694694msgstr ""
695+ ":mod:`ctypes` 暴露了 :func:`byref` 函数用于通过引用传递参数,使用 :func:`pointer` "
696+ "函数也能达到同样的效果,只不过 :func:`pointer` 需要更多步骤,因为它要先构造一个真实指针对象。所以在 Python "
697+ "代码本身不需要使用这个指针对象的情况下,使用 :func:`byref` 效率更高。"
695698
696699#: ../../library/ctypes.rst:545
697700msgid "Structures and unions"
698- msgstr ""
701+ msgstr "结构体和联合 "
699702
700703#: ../../library/ctypes.rst:547
701704msgid ""
@@ -704,43 +707,48 @@ msgid ""
704707"Each subclass must define a :attr:`_fields_` attribute. :attr:`_fields_` "
705708"must be a list of *2-tuples*, containing a *field name* and a *field type*."
706709msgstr ""
710+ "结构体和联合必须继承自 :mod:`ctypes` 模块中的 :class:`Structure` 和 :class:`Union` 。子类必须定义 "
711+ ":attr:`_fields_` 属性。 :attr:`_fields_` 是一个二元组列表,二元组中包含 *field name* 和 *field "
712+ "type* 。"
707713
708714#: ../../library/ctypes.rst:552
709715msgid ""
710716"The field type must be a :mod:`ctypes` type like :class:`c_int`, or any "
711717"other derived :mod:`ctypes` type: structure, union, array, pointer."
712718msgstr ""
719+ "type 字段必须是一个 :mod:`ctypes` 类型,比如 :class:`c_int`,或者其他 :mod:`ctypes` 类型: "
720+ "结构体、联合、数组、指针。"
713721
714722#: ../../library/ctypes.rst:555
715723msgid ""
716724"Here is a simple example of a POINT structure, which contains two integers "
717725"named *x* and *y*, and also shows how to initialize a structure in the "
718726"constructor::"
719- msgstr ""
727+ msgstr "这是一个简单的 POINT 结构体,它包含名称为 *x* 和 *y* 的两个变量,还展示了如何通过构造函数初始化结构体。 "
720728
721729#: ../../library/ctypes.rst:575
722730msgid ""
723731"You can, however, build much more complicated structures. A structure can "
724732"itself contain other structures by using a structure as a field type."
725- msgstr ""
733+ msgstr "当然,你可以构造更复杂的结构体。一个结构体可以通过设置 type 字段包含其他结构体或者自身。 "
726734
727735#: ../../library/ctypes.rst:578
728736msgid ""
729737"Here is a RECT structure which contains two POINTs named *upperleft* and "
730738"*lowerright*::"
731- msgstr ""
739+ msgstr "这是以一个 RECT 结构体,他包含了两个 POINT ,分别叫 *upperleft* 和 *lowerright*:: "
732740
733741#: ../../library/ctypes.rst:592
734742msgid ""
735743"Nested structures can also be initialized in the constructor in several "
736744"ways::"
737- msgstr ""
745+ msgstr "嵌套结构体可以通过几种方式构造初始化:: "
738746
739747#: ../../library/ctypes.rst:597
740748msgid ""
741749"Field :term:`descriptor`\\ s can be retrieved from the *class*, they are "
742750"useful for debugging because they can provide useful information::"
743- msgstr ""
751+ msgstr "可以通过 *类* 获取字段 :term:`descriptor` ,它能提供很多有用的调试信息。 "
744752
745753#: ../../library/ctypes.rst:611
746754msgid ""
@@ -749,10 +757,12 @@ msgid ""
749757"guaranteed by the library to work in the general case. Unions and "
750758"structures with bit-fields should always be passed to functions by pointer."
751759msgstr ""
760+ ":mod:`ctypes` 不支持带位域的结构体、联合以值的方式传给函数。这可能在 32 位 x86 "
761+ "平台上可以正常工作,但是对于一般情况,这种行为是未定义的。带位域的结构体、联合应该总是通过指针传递给函数。"
752762
753763#: ../../library/ctypes.rst:617
754764msgid "Structure/union alignment and byte order"
755- msgstr ""
765+ msgstr "结构体/联合 字段对齐及字节顺序 "
756766
757767#: ../../library/ctypes.rst:619
758768msgid ""
@@ -762,6 +772,8 @@ msgid ""
762772"to a positive integer and specifies the maximum alignment for the fields. "
763773"This is what ``#pragma pack(n)`` also does in MSVC."
764774msgstr ""
775+ "默认情况下,结构体和联合的字段与C的字节对齐是一样的。也可以在定义子类的时候指定类的 :attr:`_pack_` "
776+ "属性来覆盖这种行为。它必须设置为一个正整数,表示字段的最大对齐字节。这和 MSVC 中的 ``#pragma pack(n)`` 功能一样。"
765777
766778#: ../../library/ctypes.rst:625
767779msgid ""
0 commit comments