summaryrefslogtreecommitdiff
path: root/Doc/c-api
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-04-05 20:41:37 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-04-05 20:41:37 +0000
commit790465fd90e8a72590386465f518db9e67ab843f (patch)
tree62e3e47f6f97120dfdfc94a87dc1a06414d95a13 /Doc/c-api
parentb9279bc88f867d9d3b6606502a678b137329b54d (diff)
downloadcpython-git-790465fd90e8a72590386465f518db9e67ab843f.tar.gz
Change command line processing API to use wchar_t.
Fixes #2128.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/init.rst17
-rw-r--r--Doc/c-api/sys.rst4
-rw-r--r--Doc/c-api/unicode.rst2
-rw-r--r--Doc/c-api/veryhigh.rst22
4 files changed, 25 insertions, 20 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index dac37e1767..53fc735ab2 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -161,7 +161,7 @@ Initialization, Finalization, and Threads
haven't been explicitly destroyed at that point.
-.. cfunction:: void Py_SetProgramName(char *name)
+.. cfunction:: void Py_SetProgramName(wchar_t *name)
.. index::
single: Py_Initialize()
@@ -170,11 +170,12 @@ Initialization, Finalization, and Threads
This function should be called before :cfunc:`Py_Initialize` is called for
the first time, if it is called at all. It tells the interpreter the value
- of the ``argv[0]`` argument to the :cfunc:`main` function of the program.
+ of the ``argv[0]`` argument to the :cfunc:`main` function of the program
+ (converted to wide characters).
This is used by :cfunc:`Py_GetPath` and some other functions below to find
the Python run-time libraries relative to the interpreter executable. The
default value is ``'python'``. The argument should point to a
- zero-terminated character string in static storage whose contents will not
+ zero-terminated wide character string in static storage whose contents will not
change for the duration of the program's execution. No code in the Python
interpreter will change the contents of this storage.
@@ -188,7 +189,7 @@ Initialization, Finalization, and Threads
value.
-.. cfunction:: char* Py_GetPrefix()
+.. cfunction:: wchar_t* Py_GetPrefix()
Return the *prefix* for installed platform-independent files. This is derived
through a number of complicated rules from the program name set with
@@ -201,7 +202,7 @@ Initialization, Finalization, and Threads
It is only useful on Unix. See also the next function.
-.. cfunction:: char* Py_GetExecPrefix()
+.. cfunction:: wchar_t* Py_GetExecPrefix()
Return the *exec-prefix* for installed platform-*dependent* files. This is
derived through a number of complicated rules from the program name set with
@@ -236,7 +237,7 @@ Initialization, Finalization, and Threads
platform.
-.. cfunction:: char* Py_GetProgramFullPath()
+.. cfunction:: wchar_t* Py_GetProgramFullPath()
.. index::
single: Py_SetProgramName()
@@ -249,7 +250,7 @@ Initialization, Finalization, and Threads
to Python code as ``sys.executable``.
-.. cfunction:: char* Py_GetPath()
+.. cfunction:: wchar_t* Py_GetPath()
.. index::
triple: module; search; path
@@ -342,7 +343,7 @@ Initialization, Finalization, and Threads
``sys.version``.
-.. cfunction:: void PySys_SetArgv(int argc, char **argv)
+.. cfunction:: void PySys_SetArgv(int argc, wchar_t **argv)
.. index::
single: main()
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index 7696811a78..2a98c9d0e1 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -84,11 +84,11 @@ accessible to C code. They all work with the current interpreter thread's
Reset :data:`sys.warnoptions` to an empty list.
-.. cfunction:: void PySys_AddWarnOption(char *s)
+.. cfunction:: void PySys_AddWarnOption(wchar_t *s)
Append *s* to :data:`sys.warnoptions`.
-.. cfunction:: void PySys_SetPath(char *path)
+.. cfunction:: void PySys_SetPath(wchar_t *path)
Set :data:`sys.path` to a list object of paths found in *path* which should
be a list of paths separated with the platform's search path delimiter
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 448cf6895c..17c25d577f 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -336,6 +336,8 @@ the system's :ctype:`wchar_t`.
.. cfunction:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
Create a Unicode object from the :ctype:`wchar_t` buffer *w* of the given size.
+ Passing -1 as the size indicates that the function must itself compute the length,
+ using wcslen.
Return *NULL* on failure.
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 6a3f91d098..2378c76633 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -25,16 +25,18 @@ are only passed to these functions if it is certain that they were created by
the same library that the Python runtime is using.
-.. cfunction:: int Py_Main(int argc, char **argv)
-
- The main program for the standard interpreter. This is made available for
- programs which embed Python. The *argc* and *argv* parameters should be
- prepared exactly as those which are passed to a C program's :cfunc:`main`
- function. It is important to note that the argument list may be modified (but
- the contents of the strings pointed to by the argument list are not). The return
- value will be the integer passed to the :func:`sys.exit` function, ``1`` if the
- interpreter exits due to an exception, or ``2`` if the parameter list does not
- represent a valid Python command line.
+.. cfunction:: int Py_Main(int argc, wchar_t **argv)
+
+ The main program for the standard interpreter. This is made
+ available for programs which embed Python. The *argc* and *argv*
+ parameters should be prepared exactly as those which are passed to
+ a C program's :cfunc:`main` function (converted to wchar_t
+ according to the user's locale). It is important to note that the
+ argument list may be modified (but the contents of the strings
+ pointed to by the argument list are not). The return value will be
+ the integer passed to the :func:`sys.exit` function, ``1`` if the
+ interpreter exits due to an exception, or ``2`` if the parameter
+ list does not represent a valid Python command line.
.. cfunction:: int PyRun_AnyFile(FILE *fp, const char *filename)