@@ -17,7 +17,7 @@ msgid ""
1717msgstr ""
1818"Project-Id-Version : Python 3.13\n "
1919"Report-Msgid-Bugs-To : \n "
20- "POT-Creation-Date : 2024-08-23 14:16 +0000\n "
20+ "POT-Creation-Date : 2024-08-31 10:59 +0000\n "
2121"PO-Revision-Date : 2021-06-28 00:47+0000\n "
2222"Last-Translator : 石井明久, 2024\n "
2323"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
@@ -703,6 +703,13 @@ msgstr ""
703703"そうでない場合は、利用者は次のように n 次元配列にアクセスしなければなりませ"
704704"ん:"
705705
706+ #: ../../c-api/buffer.rst:368
707+ msgid ""
708+ "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * "
709+ "strides[n-1];\n"
710+ "item = *((typeof(item) *)ptr);"
711+ msgstr ""
712+
706713#: ../../c-api/buffer.rst:374
707714msgid ""
708715"As noted above, :c:member:`~Py_buffer.buf` can point to any location within "
@@ -713,6 +720,35 @@ msgstr ""
713720"すことが可能です。エクスポーターはこの関数を使用することによってバッファの妥"
714721"当性を確認出来ます。"
715722
723+ #: ../../c-api/buffer.rst:378
724+ msgid ""
725+ "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n"
726+ " \"\"\" Verify that the parameters represent a valid array within\n"
727+ " the bounds of the allocated memory:\n"
728+ " char *mem: start of the physical memory block\n"
729+ " memlen: length of the physical memory block\n"
730+ " offset: (char *)buf - mem\n"
731+ " \"\"\" \n"
732+ " if offset % itemsize:\n"
733+ " return False\n"
734+ " if offset < 0 or offset+itemsize > memlen:\n"
735+ " return False\n"
736+ " if any(v % itemsize for v in strides):\n"
737+ " return False\n"
738+ "\n"
739+ " if ndim <= 0:\n"
740+ " return ndim == 0 and not shape and not strides\n"
741+ " if 0 in shape:\n"
742+ " return True\n"
743+ "\n"
744+ " imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
745+ " if strides[j] <= 0)\n"
746+ " imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
747+ " if strides[j] > 0)\n"
748+ "\n"
749+ " return 0 <= offset+imin and offset+imax+itemsize <= memlen"
750+ msgstr ""
751+
716752#: ../../c-api/buffer.rst:408
717753msgid "PIL-style: shape, strides and suboffsets"
718754msgstr "PIL スタイル: shape, strides, suboffsets"
@@ -744,6 +780,22 @@ msgstr ""
744780"次の例は、 strides も suboffsets も ``NULL`` でない場合の、N 次元インデックス"
745781"によって指されている N 次元配列内の要素へのポインタを返す関数です::"
746782
783+ #: ../../c-api/buffer.rst:423
784+ msgid ""
785+ "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n"
786+ " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n"
787+ " char *pointer = (char*)buf;\n"
788+ " int i;\n"
789+ " for (i = 0; i < ndim; i++) {\n"
790+ " pointer += strides[i] * indices[i];\n"
791+ " if (suboffsets[i] >=0 ) {\n"
792+ " pointer = *((char**)pointer) + suboffsets[i];\n"
793+ " }\n"
794+ " }\n"
795+ " return (void*)pointer;\n"
796+ "}"
797+ msgstr ""
798+
747799#: ../../c-api/buffer.rst:438
748800msgid "Buffer-related functions"
749801msgstr "バッファ関連の関数"
0 commit comments