@@ -24,7 +24,7 @@ msgid ""
2424msgstr ""
2525"Project-Id-Version : Python 3.13\n "
2626"Report-Msgid-Bugs-To : \n "
27- "POT-Creation-Date : 2024-07-05 14:16 +0000\n "
27+ "POT-Creation-Date : 2024-08-31 10:59 +0000\n "
2828"PO-Revision-Date : 2021-06-28 00:47+0000\n "
2929"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
3030"Language-Team : Portuguese (Brazil) (https://app.transifex.com/python-doc/ "
@@ -729,6 +729,13 @@ msgstr ""
729729"vetor C n-dimensional padrão. Caso contrário, o consumidor deve acessar um "
730730"vetor n-dimensional como a seguir:"
731731
732+ #: ../../c-api/buffer.rst:368
733+ msgid ""
734+ "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * "
735+ "strides[n-1];\n"
736+ "item = *((typeof(item) *)ptr);"
737+ msgstr ""
738+
732739#: ../../c-api/buffer.rst:374
733740msgid ""
734741"As noted above, :c:member:`~Py_buffer.buf` can point to any location within "
@@ -739,6 +746,35 @@ msgstr ""
739746"localização dentro do bloco de memória em si. Um exportador pode verificar a "
740747"validade de um buffer com essa função:"
741748
749+ #: ../../c-api/buffer.rst:378
750+ msgid ""
751+ "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n"
752+ " \"\"\" Verify that the parameters represent a valid array within\n"
753+ " the bounds of the allocated memory:\n"
754+ " char *mem: start of the physical memory block\n"
755+ " memlen: length of the physical memory block\n"
756+ " offset: (char *)buf - mem\n"
757+ " \"\"\" \n"
758+ " if offset % itemsize:\n"
759+ " return False\n"
760+ " if offset < 0 or offset+itemsize > memlen:\n"
761+ " return False\n"
762+ " if any(v % itemsize for v in strides):\n"
763+ " return False\n"
764+ "\n"
765+ " if ndim <= 0:\n"
766+ " return ndim == 0 and not shape and not strides\n"
767+ " if 0 in shape:\n"
768+ " return True\n"
769+ "\n"
770+ " imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
771+ " if strides[j] <= 0)\n"
772+ " imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n"
773+ " if strides[j] > 0)\n"
774+ "\n"
775+ " return 0 <= offset+imin and offset+imax+itemsize <= memlen"
776+ msgstr ""
777+
742778#: ../../c-api/buffer.rst:408
743779msgid "PIL-style: shape, strides and suboffsets"
744780msgstr "Estilo-PIL: forma, avanços e suboffsets"
@@ -772,6 +808,22 @@ msgstr ""
772808"apontada por um índice N-dimensional onde existem ambos passos e "
773809"subconjuntos não-``NULL``::"
774810
811+ #: ../../c-api/buffer.rst:423
812+ msgid ""
813+ "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n"
814+ " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n"
815+ " char *pointer = (char*)buf;\n"
816+ " int i;\n"
817+ " for (i = 0; i < ndim; i++) {\n"
818+ " pointer += strides[i] * indices[i];\n"
819+ " if (suboffsets[i] >=0 ) {\n"
820+ " pointer = *((char**)pointer) + suboffsets[i];\n"
821+ " }\n"
822+ " }\n"
823+ " return (void*)pointer;\n"
824+ "}"
825+ msgstr ""
826+
775827#: ../../c-api/buffer.rst:438
776828msgid "Buffer-related functions"
777829msgstr "Funções relacionadas ao Buffer"
0 commit comments