77msgstr ""
88"Project-Id-Version : Python 3.12\n "
99"Report-Msgid-Bugs-To : \n "
10- "POT-Creation-Date : 2024-06 -01 00:16 +0000\n "
10+ "POT-Creation-Date : 2024-11 -01 00:21 +0000\n "
1111"PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE\n "
1212"Last-Translator : \n "
1313"Language-Team : TURKISH <python.docs.tr@gmail.com>\n "
@@ -512,13 +512,49 @@ msgid ""
512512"dimensional array as follows:"
513513msgstr ""
514514
515+ #: c-api/buffer.rst:368
516+ msgid ""
517+ "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * "
518+ "strides[n-1];\n"
519+ "item = *((typeof(item) *)ptr);"
520+ msgstr ""
521+
515522#: c-api/buffer.rst:374
516523msgid ""
517524"As noted above, :c:member:`~Py_buffer.buf` can point to any location within "
518525"the actual memory block. An exporter can check the validity of a buffer with "
519526"this function:"
520527msgstr ""
521528
529+ #: c-api/buffer.rst:378
530+ msgid ""
531+ "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n"
532+ " \"\"\" Verify that the parameters represent a valid array within\n"
533+ " the bounds of the allocated memory:\n"
534+ " char *mem: start of the physical memory block\n"
535+ " memlen: length of the physical memory block\n"
536+ " offset: (char *)buf - mem\n"
537+ " \"\"\" \n"
538+ " if offset % itemsize:\n"
539+ " return False\n"
540+ " if offset < 0 or offset+itemsize > memlen:\n"
541+ " return False\n"
542+ " if any(v % itemsize for v in strides):\n"
543+ " return False\n"
544+ "\n"
545+ " if ndim <= 0:\n"
546+ " return ndim == 0 and not shape and not strides\n"
547+ " if 0 in shape:\n"
548+ " return True\n"
549+ "\n"
550+ " imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
551+ " if strides[j] <= 0)\n"
552+ " imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
553+ " if strides[j] > 0)\n"
554+ "\n"
555+ " return 0 <= offset+imin and offset+imax+itemsize <= memlen"
556+ msgstr ""
557+
522558#: c-api/buffer.rst:408
523559msgid "PIL-style: shape, strides and suboffsets"
524560msgstr ""
@@ -541,6 +577,22 @@ msgid ""
541577"strides and suboffsets::"
542578msgstr ""
543579
580+ #: c-api/buffer.rst:423
581+ msgid ""
582+ "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n"
583+ " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n"
584+ " char *pointer = (char*)buf;\n"
585+ " int i;\n"
586+ " for (i = 0; i < ndim; i++) {\n"
587+ " pointer += strides[i] * indices[i];\n"
588+ " if (suboffsets[i] >=0 ) {\n"
589+ " pointer = *((char**)pointer) + suboffsets[i];\n"
590+ " }\n"
591+ " }\n"
592+ " return (void*)pointer;\n"
593+ "}"
594+ msgstr ""
595+
544596#: c-api/buffer.rst:438
545597msgid "Buffer-related functions"
546598msgstr ""
0 commit comments