"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.6\n"
msgid"Embedding Python in Another Application"
msgstr"تعبیه پایتون در برنامهای دیگر"
msgid"The previous chapters discussed how to extend Python, that is, how to extend the functionality of Python by attaching a library of C functions to it. It is also possible to do it the other way around: enrich your C/C++ application by embedding Python in it. Embedding provides your application with the ability to implement some of the functionality of your application in Python rather than C or C++. This can be used for many purposes; one example would be to allow users to tailor the application to their needs by writing some scripts in Python. You can also use it yourself if some of the functionality can be written in Python more easily."
msgstr "فصلهای قبلی دربارهی چگونگی توسعه دادن پایتون بحث کردند، یعنی چگونگی توسعه قابلیتهای پایتون با ضمیمه کردن یک کتابخانه از توابع C به آن. انجام این کار به روش معکوس نیز ممکن است: برنامهی C/C++ خود را با تعبیه پایتون در آن غنی کنید. تعبیه به برنامهی شما این امکان را میدهد که بخشی از قابلیتهای برنامهی خود را به جای C یا C++ در پایتون پیادهسازی کنید. از این میتوان برای اهداف بسیاری استفاده کرد؛ برای مثال، میتوان به کاربران اجازه داد با نوشتن چند اسکریپت به زبان پایتون، برنامه را مطابق نیازهایشان سفارشی کنند. اگر نوشتن بخشی از قابلیتها در پایتون آسانتر باشد، خودتان نیز میتوانید از آن استفاده کنید."
msgid"Embedding Python is similar to extending it, but not quite. The difference is that when you extend Python, the main program of the application is still the Python interpreter, while if you embed Python, the main program may have nothing to do with Python --- instead, some parts of the application occasionally call the Python interpreter to run some Python code."
msgstr"تعبیه پایتون شبیه به توسعه دادن آن است، اما نه دقیقاً. تفاوت این است که وقتی پایتون را توسعه میدهید، برنامه اصلی اپلیکیشن همچنان مفسر پایتون است، در حالی که اگر پایتون را تعبیه کنید، برنامه اصلی ممکن است هیچ ربطی به پایتون نداشته باشد --- در عوض، بخشهایی از اپلیکیشن گاهی مفسر پایتون را فراخوانی میکنند تا مقداری کد پایتون را اجرا کنند."
msgid"So if you are embedding Python, you are providing your own main program. One of the things this main program has to do is initialize the Python interpreter. At the very least, you have to call the function :c:func:`Py_Initialize`. There are optional calls to pass command line arguments to Python. Then later you can call the interpreter from any part of the application."
msgstr"پس اگر پایتون را تعبیه میکنید، برنامه اصلی خودتان را فراهم میکنید. یکی از کارهایی که این برنامه اصلی باید انجام دهد، مقداردهی اولیه مفسر پایتون است. در حداقل حالت، باید تابع :c:func:`Py_Initialize` را فراخوانی کنید. فراخوانیهای اختیاریای نیز وجود دارند که آرگومانهای خط فرمان را به پایتون منتقل میکنند. سپس بعداً میتوانید مفسر را از هر بخشی از برنامه فراخوانی کنید."
msgid"There are several different ways to call the interpreter: you can pass a string containing Python statements to :c:func:`PyRun_SimpleString`, or you can pass a stdio file pointer and a file name (for identification in error messages only) to :c:func:`PyRun_SimpleFile`. You can also call the lower-level operations described in the previous chapters to construct and use Python objects."
msgstr"راههای مختلفی برای فراخوانی مفسر وجود دارد: میتوانید رشتهای حاوی دستورهای پایتون را به :c:func:`PyRun_SimpleString` ارسال کنید، یا میتوانید اشارهگر پروندهی stdio و نام یک پرونده (فقط برای شناسایی در پیامهای خطا) را به :c:func:`PyRun_SimpleFile` ارسال کنید. همچنین میتوانید برای ساخت و استفاده از اشیای پایتون، عملیاتهای سطح پایینتری را که در فصلهای قبلی توضیح داده شدهاند فراخوانی کنید."
msgid":ref:`c-api-index`"
msgstr":ref:`c-api-index`"
msgid"The details of Python's C interface are given in this manual. A great deal of necessary information can be found here."
msgstr"جزئیات رابط C پایتون در این راهنما آمده است. اطلاعات ضروری فراوانی را میتوان در اینجا یافت."
msgid"Very High Level Embedding"
msgstr"تعبیه در سطح بسیار بالا"
msgid"The simplest form of embedding Python is the use of the very high level interface. This interface is intended to execute a Python script without needing to interact with the application directly. This can for example be used to perform some operation on a file. ::"
msgstr"سادهترین شکل تعبیه پایتون، استفاده از رابط سطح بسیار بالا است. این رابط برای اجرای یک اسکریپت پایتون بدون نیاز به تعامل مستقیم با برنامه در نظر گرفته شده است. برای مثال، میتوان از این برای انجام عملیاتی روی یک پرونده استفاده کرد. ::"
msgid""
"#define PY_SSIZE_T_CLEAN\n"
"#include <Python.h>\n"
"\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
" PyStatus status;\n"
" PyConfig config;\n"
" PyConfig_InitPythonConfig(&config);\n"
"\n"
" /* optional but recommended */\n"
" status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);\n"
" if (PyStatus_Exception(status)) {\n"
" goto exception;\n"
" }\n"
"\n"
" status = Py_InitializeFromConfig(&config);\n"
" if (PyStatus_Exception(status)) {\n"
" goto exception;\n"
" }\n"
" PyConfig_Clear(&config);\n"
"\n"
" PyRun_SimpleString(\"from time import time,ctime\\n\"\n"
" \"print('Today is', ctime(time()))\\n\");\n"
" if (Py_FinalizeEx() < 0) {\n"
" exit(120);\n"
" }\n"
" return 0;\n"
"\n"
" exception:\n"
" PyConfig_Clear(&config);\n"
" Py_ExitStatusException(status);\n"
"}"
msgstr""
"#define PY_SSIZE_T_CLEAN\n"
"#include <Python.h>\n"
"\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
" PyStatus status;\n"
" PyConfig config;\n"
" PyConfig_InitPythonConfig(&config);\n"
"\n"
" /* optional but recommended */\n"
" status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);\n"
" if (PyStatus_Exception(status)) {\n"
" goto exception;\n"
" }\n"
"\n"
" status = Py_InitializeFromConfig(&config);\n"
" if (PyStatus_Exception(status)) {\n"
" goto exception;\n"
" }\n"
" PyConfig_Clear(&config);\n"
"\n"
" PyRun_SimpleString(\"from time import time,ctime\\n\"\n"
" \"print('Today is', ctime(time()))\\n\");\n"
" if (Py_FinalizeEx() < 0) {\n"
" exit(120);\n"
" }\n"
" return 0;\n"
"\n"
" exception:\n"
" PyConfig_Clear(&config);\n"
" Py_ExitStatusException(status);\n"
"}"
msgid"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be used in some APIs instead of ``int``. It is not necessary since Python 3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-string-and-buffers` for a description of this macro."
msgstr"``#define PY_SSIZE_T_CLEAN`` برای نشان دادن این نکته استفاده میشد که در برخی APIها باید بهجای ``int`` از ``Py_ssize_t`` استفاده شود. از پایتون 3.13 به بعد دیگر لازم نیست، اما برای سازگاری با نسخههای پیشین، آن را اینجا نگه میداریم. برای شرح این ماکرو به :ref:`arg-parsing-string-and-buffers` مراجعه کنید."
msgid"Setting :c:member:`PyConfig.program_name` should be called before :c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time libraries. Next, the Python interpreter is initialized with :c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the program. In a real program, you may want to get the Python script from another source, perhaps a text-editor routine, a file, or a database. Getting the Python code from a file can better be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating memory space and loading the file contents."
msgstr "تنظیم :c:member:`PyConfig.program_name` باید پیش از :c:func:`Py_InitializeFromConfig` انجام شود تا مفسر را از مسیرهای کتابخانههای زمان اجرای پایتون آگاه کند. سپس، مفسر پایتون با :c:func:`Py_Initialize` مقداردهی اولیه میشود و در ادامه، یک اسکریپت پایتونِ هاردکدشده (hard-coded) که تاریخ و زمان را چاپ میکند، اجرا میشود. پس از آن، فراخوانی :c:func:`Py_FinalizeEx` مفسر را متوقف میکند و در نهایت برنامه به پایان میرسد. در یک برنامهی واقعی، ممکن است بخواهید اسکریپت پایتون را از منبع دیگری دریافت کنید؛ مثلاً از یک روتین ویرایشگر متن، یک پرونده یا یک پایگاه داده. گرفتن کد پایتون از یک پرونده را بهتر میتوان با استفاده از تابع :c:func:`PyRun_SimpleFile` انجام داد که شما را از دردسر تخصیص فضای حافظه و بارگذاری محتوای پرونده بینیاز میکند."
msgid"Beyond Very High Level Embedding: An overview"
msgstr"فراتر از تعبیه در سطح بسیار بالا: مروری کلی"
msgid"The high level interface gives you the ability to execute arbitrary pieces of Python code from your application, but exchanging data values is quite cumbersome to say the least. If you want that, you should use lower level calls. At the cost of having to write more C code, you can achieve almost anything."
msgstr"رابط سطح بالا به شما امکان میدهد قطعات دلخواهی از کد پایتون را از درون برنامهتان اجرا کنید، اما تبادل مقادیر داده، دستکم بگوییم، بسیار پرزحمت است. اگر چنین چیزی میخواهید، باید از فراخوانیهای سطح پایینتر استفاده کنید. به بهای اینکه ناچار شوید کد C بیشتری بنویسید، میتوانید تقریباً هر کاری را انجام دهید."
msgid"It should be noted that extending Python and embedding Python is quite the same activity, despite the different intent. Most topics discussed in the previous chapters are still valid. To show this, consider what the extension code from Python to C really does:"
msgstr"باید توجه داشت که توسعه دادن پایتون و تعبیه کردن پایتون، با وجود تفاوت در هدف، تقریباً یک فعالیت واحد هستند. بیشتر مباحثی که در فصلهای پیشین بحث شدهاند، همچنان معتبرند. برای نشان دادن این موضوع، در نظر بگیرید که کد توسعهای از پایتون به C در واقع چه کاری انجام میدهد:"
msgid"Convert data values from Python to C,"
msgstr"تبدیل مقادیر داده از پایتون به C،"
msgid"Perform a function call to a C routine using the converted values, and"
msgstr"با استفاده از مقادیر تبدیلشده، فراخوانی تابعی به یک روتین C را انجام دهید، و"
msgid"Convert the data values from the call from C to Python."
msgstr"مقادیر دادهی حاصل از فراخوانی را از C به پایتون تبدیل کنید."
msgid"When embedding Python, the interface code does:"
msgstr"هنگام تعبیه پایتون، کد رابط کارهای زیر را انجام میدهد:"
msgid"Convert data values from C to Python,"
msgstr"تبدیل مقادیر داده از C به پایتون،"
msgid"Perform a function call to a Python interface routine using the converted values, and"
msgstr"با استفاده از مقادیر تبدیلشده، یک فراخوانی تابع به یک روتین رابط پایتون انجام دهید و"
msgid"Convert the data values from the call from Python to C."
msgstr"مقادیر داده را از فراخوانی، از پایتون به C تبدیل کنید."
msgid"As you can see, the data conversion steps are simply swapped to accommodate the different direction of the cross-language transfer. The only difference is the routine that you call between both data conversions. When extending, you call a C routine, when embedding, you call a Python routine."
msgstr"همانطور که میبینید، گامهای تبدیل داده صرفاً برای سازگاری با جهت متفاوتِ انتقال بین دو زبان جابهجا شدهاند. تنها تفاوت، روالی است که بین هر دو تبدیل داده فراخوانی میکنید. هنگام توسعه دادن، یک روال C را فراخوانی میکنید؛ هنگام تعبیه، یک روال پایتون را."
msgid"This chapter will not discuss how to convert data from Python to C and vice versa. Also, proper use of references and dealing with errors is assumed to be understood. Since these aspects do not differ from extending the interpreter, you can refer to earlier chapters for the required information."
msgstr"این فصل دربارهی نحوهی تبدیل دادهها از پایتون به C و برعکس بحث نمیکند. همچنین، فرض بر این است که استفادهی صحیح از ارجاعها و برخورد با خطاها را درک کردهاید. از آنجا که این جنبهها با توسعهی مفسر تفاوتی ندارند، میتوانید برای اطلاعات مورد نیاز به فصلهای پیشین مراجعه کنید."
msgid"Pure Embedding"
msgstr"تعبیه خالص (Pure Embedding)"
msgid"The first program aims to execute a function in a Python script. Like in the section about the very high level interface, the Python interpreter does not directly interact with the application (but that will change in the next section)."
msgstr"هدف اولین برنامه، اجرای یک تابع در یک اسکریپت پایتون است. مانند بخش مربوط به رابط سطح بسیار بالا، مفسر پایتون مستقیماً با برنامه تعامل نمیکند (اما این موضوع در بخش بعدی تغییر خواهد کرد)."
msgid"The code to run a function defined in a Python script is:"
msgstr"کد اجرای تابع تعریفشده در یک اسکریپت پایتون چنین است:"
" printf(\"Result of call: %ld\\n\", PyLong_AsLong(pValue));\n"
" Py_DECREF(pValue);\n"
" }\n"
" else {\n"
" Py_DECREF(pFunc);\n"
" Py_DECREF(pModule);\n"
" PyErr_Print();\n"
" fprintf(stderr,\"Call failed\\n\");\n"
" return 1;\n"
" }\n"
" }\n"
" else {\n"
" if (PyErr_Occurred())\n"
" PyErr_Print();\n"
" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", argv[2]);\n"
" }\n"
" Py_XDECREF(pFunc);\n"
" Py_DECREF(pModule);\n"
" }\n"
" else {\n"
" PyErr_Print();\n"
" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n"
" return 1;\n"
" }\n"
" if (Py_FinalizeEx() < 0) {\n"
" return 120;\n"
" }\n"
" return 0;\n"
"}\n"
msgid"This code loads a Python script using ``argv[1]``, and calls the function named in ``argv[2]``. Its integer arguments are the other values of the ``argv`` array. If you :ref:`compile and link <compiling>` this program (let's call the finished executable :program:`call`), and use it to execute a Python script, such as:"
msgstr"این کد با استفاده از ``argv[1]`` یک اسکریپت پایتون را بارگذاری میکند و تابعی را که نام آن در ``argv[2]`` آمده است فراخوانی میکند. آرگومانهای عدد صحیح آن، مقادیر دیگر آرایهی ``argv`` هستند. اگر این برنامه را :ref:`کامپایل و لینک <compiling>` کنید (فرض کنید نام پرونده اجرایی نهایی :program:`call` باشد) و از آن برای اجرای یک اسکریپت پایتون استفاده کنید، مانند:"
msgid""
"def multiply(a,b):\n"
" print(\"Will compute\", a, \"times\", b)\n"
" c = 0\n"
" for i in range(0, a):\n"
" c = c + b\n"
" return c"
msgstr""
"def multiply(a,b):\n"
" print(\"Will compute\", a, \"times\", b)\n"
" c = 0\n"
" for i in range(0, a):\n"
" c = c + b\n"
" return c"
msgid"then the result should be:"
msgstr"در این صورت نتیجه باید چنین باشد:"
msgid""
"$ call multiply multiply 3 2\n"
"Will compute 3 times 2\n"
"Result of call: 6"
msgstr""
"$ call multiply multiply 3 2\n"
"۳ ضربدر ۲ محاسبه خواهد شد\n"
"نتیجهی فراخوانی: ۶"
msgid"Although the program is quite large for its functionality, most of the code is for data conversion between Python and C, and for error reporting. The interesting part with respect to embedding Python starts with ::"
msgstr"با اینکه این برنامه نسبت به کارکردش بسیار بزرگ است، بیشترِ کد آن برای تبدیل داده بین پایتون و C و برای گزارش خطا است. بخش جالب از نظر تعبیه پایتون با کد زیر آغاز میشود::"
msgid""
"Py_Initialize();\n"
"pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
"/* Error checking of pName left out */\n"
"pModule = PyImport_Import(pName);"
msgstr""
"Py_Initialize();\n"
"pName = PyUnicode_DecodeFSDefault(argv[1]);\n"
"/* Error checking of pName left out */\n"
"pModule = PyImport_Import(pName);"
msgid"After initializing the interpreter, the script is loaded using :c:func:`PyImport_Import`. This routine needs a Python string as its argument, which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data conversion routine. ::"
msgstr"پس از مقداردهی اولیهی مفسر، اسکریپت با استفاده از :c:func:`PyImport_Import` بارگذاری میشود. این روتین به یک رشته پایتون بهعنوان آرگومان خود نیاز دارد که با استفاده از روتین تبدیل دادهی :c:func:`PyUnicode_DecodeFSDefault` ساخته میشود. ::"
msgid"Once the script is loaded, the name we're looking for is retrieved using :c:func:`PyObject_GetAttrString`. If the name exists, and the object returned is callable, you can safely assume that it is a function. The program then proceeds by constructing a tuple of arguments as normal. The call to the Python function is then made with::"
msgstr"پس از بارگذاری اسکریپت، نامی که به دنبال آن هستیم با استفاده از :c:func:`PyObject_GetAttrString` بازیابی میشود. اگر نام وجود داشته باشد و شیء بازگرداندهشده فراخوانیپذیر باشد، میتوانید با اطمینان فرض کنید که آن یک تابع است. سپس برنامه بهصورت معمول با ساخت تاپلی از آرگومانها پیش میرود. فراخوانی تابع پایتون سپس به این صورت انجام میشود::"
msgid"Upon return of the function, ``pValue`` is either ``NULL`` or it contains a reference to the return value of the function. Be sure to release the reference after examining the value."
msgstr"پس از بازگشت تابع، ``pValue`` یا ``NULL`` است یا ارجاعی به مقدار بازگشتی تابع را در خود دارد. حتماً پس از بررسی مقدار، ارجاع را آزاد کنید."
msgid"Extending Embedded Python"
msgstr"توسعه پایتون تعبیهشده"
msgid"Until now, the embedded Python interpreter had no access to functionality from the application itself. The Python API allows this by extending the embedded interpreter. That is, the embedded interpreter gets extended with routines provided by the application. While it sounds complex, it is not so bad. Simply forget for a while that the application starts the Python interpreter. Instead, consider the application to be a set of subroutines, and write some glue code that gives Python access to those routines, just like you would write a normal Python extension. For example::"
msgstr"تاکنون، مفسر تعبیهشدهی پایتون هیچ دسترسیای به کارکردهای خودِ برنامه نداشت. API پایتون این کار را از طریق توسعه دادن مفسر تعبیهشده ممکن میسازد. یعنی مفسر تعبیهشده با روتینهایی که برنامه فراهم میکند، توسعه مییابد. اگرچه پیچیده به نظر میرسد، چندان هم بد نیست. فقط برای مدتی فراموش کنید که برنامه مفسر پایتون را راهاندازی میکند. در عوض، برنامه را مجموعهای از زیرروتینها در نظر بگیرید و کمی کد چسبان (glue code) بنویسید که دسترسی پایتون به آن روتینها را فراهم کند، درست همانطور که یک توسعهی معمولی پایتون مینویسید. برای مثال::"
msgid""
"static int numargs=0;\n"
"\n"
"/* Return the number of arguments of the application command line */\n"
"static PyObject*\n"
"emb_numargs(PyObject *self, PyObject *args)\n"
"{\n"
" if(!PyArg_ParseTuple(args, \":numargs\"))\n"
" return NULL;\n"
" return PyLong_FromLong(numargs);\n"
"}\n"
"\n"
"static PyMethodDef emb_module_methods[] = {\n"
" {\"numargs\", emb_numargs, METH_VARARGS,\n"
" \"Return the number of arguments received by the process.\"},\n"
" {NULL, NULL, 0, NULL}\n"
"};\n"
"\n"
"static struct PyModuleDef emb_module = {\n"
" .m_base = PyModuleDef_HEAD_INIT,\n"
" .m_name = \"emb\",\n"
" .m_size = 0,\n"
" .m_methods = emb_module_methods,\n"
"};\n"
"\n"
"static PyObject*\n"
"PyInit_emb(void)\n"
"{\n"
" return PyModuleDef_Init(&emb_module);\n"
"}"
msgstr""
"static int numargs=0;\n"
"\n"
"/* Return the number of arguments of the application command line */\n"
"static PyObject*\n"
"emb_numargs(PyObject *self, PyObject *args)\n"
"{\n"
" if(!PyArg_ParseTuple(args, \":numargs\"))\n"
" return NULL;\n"
" return PyLong_FromLong(numargs);\n"
"}\n"
"\n"
"static PyMethodDef emb_module_methods[] = {\n"
" {\"numargs\", emb_numargs, METH_VARARGS,\n"
" \"Return the number of arguments received by the process.\"},\n"
" {NULL, NULL, 0, NULL}\n"
"};\n"
"\n"
"static struct PyModuleDef emb_module = {\n"
" .m_base = PyModuleDef_HEAD_INIT,\n"
" .m_name = \"emb\",\n"
" .m_size = 0,\n"
" .m_methods = emb_module_methods,\n"
"};\n"
"\n"
"static PyObject*\n"
"PyInit_emb(void)\n"
"{\n"
" return PyModuleDef_Init(&emb_module);\n"
"}"
msgid"Insert the above code just above the :c:func:`main` function. Also, insert the following two statements before the call to :c:func:`Py_Initialize`::"
msgstr"کد بالا را بلافاصله بالای تابع :c:func:`main` درج کنید. همچنین، دو دستور زیر را پیش از فراخوانی :c:func:`Py_Initialize` درج کنید::"
msgid""
"numargs = argc;\n"
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
msgstr""
"numargs = argc;\n"
"PyImport_AppendInittab(\"emb\", &PyInit_emb);"
msgid"These two lines initialize the ``numargs`` variable, and make the :func:`!emb.numargs` function accessible to the embedded Python interpreter. With these extensions, the Python script can do things like"
msgstr"این دو سطر متغیر ``numargs`` را مقداردهی اولیه میکنند و تابع :func:`!emb.numargs` را برای مفسر پایتون تعبیهشده در دسترس قرار میدهند. با این توسعهها، اسکریپت پایتون میتواند کارهایی از این دست انجام دهد"
msgid""
"import emb\n"
"print(\"Number of arguments\", emb.numargs())"
msgstr""
"import emb\n"
"print(\"Number of arguments\", emb.numargs())"
msgid"In a real application, the methods will expose an API of the application to Python."
msgstr"در یک برنامهی واقعی، متدها API برنامه را برای پایتون در دسترس قرار خواهند داد."
msgid"Embedding Python in C++"
msgstr"تعبیه پایتون در C++"
msgid"It is also possible to embed Python in a C++ program; precisely how this is done will depend on the details of the C++ system used; in general you will need to write the main program in C++, and use the C++ compiler to compile and link your program. There is no need to recompile Python itself using C++."
msgstr"همچنین میتوان پایتون را در یک برنامه C++ تعبیه کرد؛ اینکه این کار دقیقاً چگونه انجام میشود، به جزئیات سیستم C++ مورد استفاده بستگی دارد؛ بهطور کلی باید برنامه اصلی را به C++ بنویسید و از کامپایلر C++ برای کامپایل و پیوند دادن برنامه خود استفاده کنید. نیازی نیست خود پایتون با C++ مجدداً کامپایل شود."
msgid"Compiling and Linking under Unix-like systems"
msgstr"کامپایل و پیوند دادن در سیستمهای شبهیونیکس"
msgid"It is not necessarily trivial to find the right flags to pass to your compiler (and linker) in order to embed the Python interpreter into your application, particularly because Python needs to load library modules implemented as C dynamic extensions (:file:`.so` files) linked against it."
msgstr"یافتن پرچمهای مناسب برای دادن به کامپایلر (و پیونددهنده) شما بهمنظور تعبیه مفسر پایتون در برنامهتان، لزوماً کار سادهای نیست؛ بهویژه از آن رو که پایتون باید ماژولهای کتابخانهای پیادهسازیشده بهصورت توسعههای پویای C (پروندههای :file:`.so`) که به آن پیوند شدهاند را بارگذاری کند."
msgid"To find out the required compiler and linker flags, you can execute the :file:`python{X.Y}-config` script which is generated as part of the installation process (a :file:`python3-config` script may also be available). This script has several options, of which the following will be directly useful to you:"
msgstr"برای یافتن پرچمهای مورد نیاز کامپایلر و پیونددهنده، میتوانید اسکریپت :file:`python{X.Y}-config` را اجرا کنید که به عنوان بخشی از فرایند نصب تولید میشود (ممکن است اسکریپت :file:`python3-config` نیز در دسترس باشد). این اسکریپت چندین گزینه دارد که از میان آنها، موارد زیر مستقیماً به کار شما خواهند آمد:"
msgid"``pythonX.Y-config --cflags`` will give you the recommended flags when compiling:"
msgstr"``pythonX.Y-config --cflags`` پرچمهای توصیهشده برای کامپایل را به شما میدهد:"
msgid"To avoid confusion between several Python installations (and especially between the system Python and your own compiled Python), it is recommended that you use the absolute path to :file:`python{X.Y}-config`, as in the above example."
msgstr"برای جلوگیری از سردرگمی میان چندین نصب پایتون (و بهویژه میان پایتون سیستم و پایتون کامپایلشدهی خودتان)، توصیه میشود که از مسیر مطلق :file:`python{X.Y}-config` استفاده کنید، همانطور که در مثال بالا آمده است."
msgid"If this procedure doesn't work for you (it is not guaranteed to work for all Unix-like platforms; however, we welcome :ref:`bug reports <reporting-bugs>`) you will have to read your system's documentation about dynamic linking and/or examine Python's :file:`Makefile` (use :func:`sysconfig.get_makefile_filename` to find its location) and compilation options. In this case, the :mod:`sysconfig` module is a useful tool to programmatically extract the configuration values that you will want to combine together. For example:"
msgstr"اگر این روش برای شما کار نکند (تضمینی نیست که روی همهی سکوهای شبهیونیکس کار کند؛ با این حال، از :ref:`گزارشهای اشکال <reporting-bugs>` استقبال میکنیم) ناچار خواهید بود مستندات سیستم خود را دربارهی پیونددهی پویا بخوانید و/یا :file:`Makefile` پایتون (برای یافتن مکان آن از :func:`sysconfig.get_makefile_filename` استفاده کنید) و گزینههای کامپایل را بررسی کنید. در این صورت، ماژول :mod:`sysconfig` ابزاری مفید برای استخراج برنامهای مقادیر پیکربندیای است که میخواهید آنها را با هم ترکیب کنید. برای مثال:"