77msgstr "" 
88"Project-Id-Version : Python 3.12\n "
99"Report-Msgid-Bugs-To : \n "
10- "POT-Creation-Date : 2024-05-28 00:03+0000 \n "
10+ "POT-Creation-Date : 2024-09-01 22:24+0800 \n "
1111"PO-Revision-Date : 2018-05-23 14:30+0000\n "
1212"
Last-Translator : 
Adrian Liaw <[email protected] >\n "
1313"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -303,7 +303,7 @@ msgstr ""
303303
304304#:  ../../c-api/buffer.rst:218 
305305msgid  "Constants:" 
306- msgstr  "" 
306+ msgstr  "常數: " 
307307
308308#:  ../../c-api/buffer.rst:222 
309309msgid  "" 
@@ -533,13 +533,52 @@ msgid ""
533533"dimensional array as follows:" 
534534msgstr  "" 
535535
536+ #:  ../../c-api/buffer.rst:368 
537+ msgid  "" 
538+ "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " 
539+ "strides[n-1];\n" 
540+ "item = *((typeof(item) *)ptr);" 
541+ msgstr  "" 
542+ "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " 
543+ "strides[n-1];\n" 
544+ "item = *((typeof(item) *)ptr);" 
545+ 
536546#:  ../../c-api/buffer.rst:374 
537547msgid  "" 
538548"As noted above, :c:member:`~Py_buffer.buf` can point to any location within " 
539549"the actual memory block. An exporter can check the validity of a buffer with " 
540550"this function:" 
541551msgstr  "" 
542552
553+ #:  ../../c-api/buffer.rst:378 
554+ msgid  "" 
555+ "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" 
556+ "    \"\"\" Verify that the parameters represent a valid array within\n" 
557+ "       the bounds of the allocated memory:\n" 
558+ "           char *mem: start of the physical memory block\n" 
559+ "           memlen: length of the physical memory block\n" 
560+ "           offset: (char *)buf - mem\n" 
561+ "    \"\"\" \n" 
562+ "    if offset % itemsize:\n" 
563+ "        return False\n" 
564+ "    if offset < 0 or offset+itemsize > memlen:\n" 
565+ "        return False\n" 
566+ "    if any(v % itemsize for v in strides):\n" 
567+ "        return False\n" 
568+ "\n" 
569+ "    if ndim <= 0:\n" 
570+ "        return ndim == 0 and not shape and not strides\n" 
571+ "    if 0 in shape:\n" 
572+ "        return True\n" 
573+ "\n" 
574+ "    imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" 
575+ "               if strides[j] <= 0)\n" 
576+ "    imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" 
577+ "               if strides[j] > 0)\n" 
578+ "\n" 
579+ "    return 0 <= offset+imin and offset+imax+itemsize <= memlen" 
580+ msgstr  "" 
581+ 
543582#:  ../../c-api/buffer.rst:408 
544583msgid  "PIL-style: shape, strides and suboffsets" 
545584msgstr  "" 
@@ -562,6 +601,34 @@ msgid ""
562601"strides and suboffsets::" 
563602msgstr  "" 
564603
604+ #:  ../../c-api/buffer.rst:423 
605+ msgid  "" 
606+ "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" 
607+ "                       Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" 
608+ "    char *pointer = (char*)buf;\n" 
609+ "    int i;\n" 
610+ "    for (i = 0; i < ndim; i++) {\n" 
611+ "        pointer += strides[i] * indices[i];\n" 
612+ "        if (suboffsets[i] >=0 ) {\n" 
613+ "            pointer = *((char**)pointer) + suboffsets[i];\n" 
614+ "        }\n" 
615+ "    }\n" 
616+ "    return (void*)pointer;\n" 
617+ "}" 
618+ msgstr  "" 
619+ "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" 
620+ "                       Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" 
621+ "    char *pointer = (char*)buf;\n" 
622+ "    int i;\n" 
623+ "    for (i = 0; i < ndim; i++) {\n" 
624+ "        pointer += strides[i] * indices[i];\n" 
625+ "        if (suboffsets[i] >=0 ) {\n" 
626+ "            pointer = *((char**)pointer) + suboffsets[i];\n" 
627+ "        }\n" 
628+ "    }\n" 
629+ "    return (void*)pointer;\n" 
630+ "}" 
631+ 
565632#:  ../../c-api/buffer.rst:438 
566633msgid  "Buffer-related functions" 
567634msgstr  "" 
0 commit comments