doc: add function string_split_shell in plugin API reference

v2.8-utf8proc
Sebastien Helleu 2014-02-14 11:15:09 +01:00
parent 05eda016ec
commit fa2600f496
5 changed files with 189 additions and 2 deletions

View File

@ -1326,6 +1326,51 @@ weechat_string_free_split (argv);
[NOTE]
This function is not available in scripting API.
==== weechat_string_split_shell
_WeeChat ≥ 0.4.4._
Split a string like the shell does for a command with arguments.
This function is a C conversion of Python class "shlex" (file: Lib/shlex.py in
Python repository), see: http://docs.python.org/3/library/shlex.html.
Prototype:
[source,C]
----
char **weechat_string_split_shell (const char *string, int *num_items);
----
Arguments:
* 'string': string to split
* 'num_items': pointer to int which will contain number of items created
Return value:
* array of strings, NULL if problem (must be freed by calling
<<_weechat_string_free_split,weechat_string_free_split>> after use)
C example:
[source,C]
----
char **argv;
int argc;
argv = weechat_string_split_shell ("test 'first arg' \"second arg\"", &argc);
/* result: argv[0] == "test"
argv[1] == "first arg"
argv[2] == "second arg"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]
This function is not available in scripting API.
==== weechat_string_free_split
Free memory used by a split string.

View File

@ -1350,6 +1350,54 @@ weechat_string_free_split (argv);
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
==== weechat_string_split_shell
_WeeChat ≥ 0.4.4._
Découper une chaîne comme le shell le fait pour une commande avec ses
paramètres.
Cette fonction est une conversion en C de la classe Python "shlex" (fichier :
Lib/shlex.py dans le dépôt Python), voir :
http://docs.python.org/3/library/shlex.html.
Prototype :
[source,C]
----
char **weechat_string_split_shell (const char *string, int *num_items);
----
Paramètres :
* 'string' : chaîne à découper
* 'num_items' : pointeur vers un entier qui contiendra le nombre de chaînes
créées
Valeur de retour :
* tableau de chaînes, NULL en cas de problème (doit être supprimé par un appel à
<<_weechat_string_free_split,weechat_string_free_split>> après utilisation)
Exemple en C :
[source,C]
----
char **argv;
int argc;
argv = weechat_string_split_shell ("test 'first arg' \"second arg\"", &argc);
/* résultat: argv[0] == "test"
argv[1] == "first arg"
argv[2] == "second arg"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
==== weechat_string_free_split
Supprimer une chaîne découpée.

View File

@ -1361,6 +1361,53 @@ weechat_string_free_split (argv);
[NOTE]
Questa funzione non è disponibile nelle API per lo scripting.
==== weechat_string_split_shell
_WeeChat ≥ 0.4.4._
// TRANSLATION MISSING
Split a string like the shell does for a command with arguments.
// TRANSLATION MISSING
This function is a C conversion of Python class "shlex" (file: Lib/shlex.py in
Python repository), see: http://docs.python.org/3/library/shlex.html.
Prototipo:
[source,C]
----
char **weechat_string_split_shell (const char *string, int *num_items);
----
Argomenti:
* 'string': stringa da dividere
* 'num_items': puntatore ad int che conterrà il numero di elementi creati
Valore restituito:
* array di stringhe, NULL se si verifica un problema (deve essere liberata chiamando
<<_weechat_string_free_split,weechat_string_free_split>> dopo l'uso)
Esempio in C:
[source,C]
----
char **argv;
int argc;
argv = weechat_string_split_shell ("test 'first arg' \"second arg\"", &argc);
/* result: argv[0] == "test"
argv[1] == "first arg"
argv[2] == "second arg"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]
Questa funzione non è disponibile nelle API per lo scripting.
==== weechat_string_free_split
Libera la memoria usata per la divisione di una stringa.

View File

@ -1327,6 +1327,53 @@ weechat_string_free_split (argv);
[NOTE]
スクリプト API ではこの関数を利用できません。
==== weechat_string_split_shell
_WeeChat バージョン 0.4.4 以上で利用可。_
// TRANSLATION MISSING
Split a string like the shell does for a command with arguments.
// TRANSLATION MISSING
This function is a C conversion of Python class "shlex" (file: Lib/shlex.py in
Python repository), see: http://docs.python.org/3/library/shlex.html.
プロトタイプ:
[source,C]
----
char **weechat_string_split_shell (const char *string, int *num_items);
----
引数:
* 'string': 分割する文字列
* 'num_items': 分割回数を返す整数型変数へのポインタ
戻り値:
* 文字列の配列、分割に失敗した場合は NULL (使用後には必ず
<<_weechat_string_free_split,weechat_string_free_split>> を呼び出して領域を開放してください)
C 言語での使用例:
[source,C]
----
char **argv;
int argc;
argv = weechat_string_split_shell ("test 'first arg' \"second arg\"", &argc);
/* result: argv[0] == "test"
argv[1] == "first arg"
argv[2] == "second arg"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]
スクリプト API ではこの関数を利用できません。
==== weechat_string_free_split
文字列分割に使用したメモリを開放。

View File

@ -1614,8 +1614,8 @@ string_split_shared (const char *string, const char *separators, int keep_eol,
/*
* Splits a string like the shell does for a command with arguments.
*
* This function is a C conversion of python class "shlex"
* (file: Lib/shlex.py in python repository)
* This function is a C conversion of Python class "shlex"
* (file: Lib/shlex.py in Python repository)
* Doc: http://docs.python.org/3/library/shlex.html
*
* Copyrights in shlex.py: