1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

doc: add chapter about WeeChat architecture in scripting guide

This commit is contained in:
Sébastien Helleu
2019-05-12 09:25:45 +02:00
parent a24817b141
commit 1d3d0aa66e
6 changed files with 146 additions and 0 deletions
+24
View File
@@ -45,6 +45,30 @@ Allerdings ist die API für alle Skriptsprachen nahezu identisch.
[[scripts_in_weechat]]
== Skripten in WeeChat
// TRANSLATION MISSING
[[weechat_architecture]]
=== WeeChat architecture
WeeChat is single-threaded, and this applies to scripts as well.
The code of a script is executed:
* when the script is loaded: typically a call to the
<<register_function,register function>>
* when a hook callback is called by WeeChat (see the chapter <<hooks,Hooks>>).
When the code of a script is executed, WeeChat waits for the end of execution
before going on. Therefore the script must *NOT* do blocking operations like
network calls without using a dedicated API function like `hook_process`.
[IMPORTANT]
A script must *NEVER* fork or create threads without using a dedicated API
function, this can crash WeeChat. +
If something must be run in background, the function `hook_process` can be used.
See example in the chapter <<hook_process,Hintergrundprozesse>>
and the documentation on the function `hook_process` in the
link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference] (Englisch).
[[languages_specificities]]
=== Besonderheiten der einzelnen Skriptsprachen
+23
View File
@@ -39,6 +39,29 @@ other languages.
[[scripts_in_weechat]]
== Scripts in WeeChat
[[weechat_architecture]]
=== WeeChat architecture
WeeChat is single-threaded, and this applies to scripts as well.
The code of a script is executed:
* when the script is loaded: typically a call to the
<<register_function,register function>>
* when a hook callback is called by WeeChat (see the chapter <<hooks,Hooks>>).
When the code of a script is executed, WeeChat waits for the end of execution
before going on. Therefore the script must *NOT* do blocking operations like
network calls without using a dedicated API function like `hook_process`.
[IMPORTANT]
A script must *NEVER* fork or create threads without using a dedicated API
function, this can crash WeeChat. +
If something must be run in background, the function `hook_process` can be used.
See example in the chapter <<hook_process,Run a background process>>
and the documentation on the function `hook_process` in the
link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference].
[[languages_specificities]]
=== Languages specificities
+27
View File
@@ -41,6 +41,33 @@ l'API est la même pour les autres langages.
[[scripts_in_weechat]]
== Scripts dans WeeChat
[[weechat_architecture]]
=== Architecture de WeeChat
WeeChat tourne dans un seul thread, et ceci est valable pour les scripts
également.
Le code d'un script est exécuté :
* lorsque le script est chargé : typiquement un appel à la
<<register_function,fonction register>>
* lorsque la fonction de rappel d'un "hook" est appelée par WeeChat
(voir le chapitre <<hooks,Hooks>>).
Lorsque le code du script est exécuté, WeeChat attend la fin de l'exécutio
avant de continuer. Par conséquent, le script ne doit *PAS* faire d'opérations
bloquantes comme des appels réseau sans utiliser une fonction API dédiée
telle que `hook_process`.
[IMPORTANT]
Un script ne doit *JAMAIS* faire de "fork" ou créer des threads sans utiliser
une fonction dédiée de l'API, cela pourrait provoquer un crash de WeeChat. +
Si quelque chose doit être lancé en arrière-plan, la fonction `hook_process`
peut être utilisée. Voir l'exemple dans le chapitre
<<hook_process,Lancer un processus en tâche de fond>> et la documentation sur
la fonction `hook_process` dans la
link:weechat_plugin_api.en.html#_hook_process[Référence API extension WeeChat].
[[languages_specificities]]
=== Spécificités des langages
+24
View File
@@ -47,6 +47,30 @@ Quasi tutti gli esempi in questo manuale sono scritti in Python, ma l'API
[[scripts_in_weechat]]
== Script in WeeChat
// TRANSLATION MISSING
[[weechat_architecture]]
=== WeeChat architecture
WeeChat is single-threaded, and this applies to scripts as well.
The code of a script is executed:
* when the script is loaded: typically a call to the
<<register_function,register function>>
* when a hook callback is called by WeeChat (see the chapter <<hooks,Hooks>>).
When the code of a script is executed, WeeChat waits for the end of execution
before going on. Therefore the script must *NOT* do blocking operations like
network calls without using a dedicated API function like `hook_process`.
[IMPORTANT]
A script must *NEVER* fork or create threads without using a dedicated API
function, this can crash WeeChat. +
If something must be run in background, the function `hook_process` can be used.
See example in the chapter <<hook_process,Eseguire un processo in background>>
and the documentation on the function `hook_process` in the
link:weechat_plugin_api.it.html#_hook_process[WeeChat plugin API reference].
[[languages_specificities]]
=== Specifiche per i linguaggi
+24
View File
@@ -45,6 +45,30 @@ WeeChat (Wee Enhanced Environment for Chat)
[[scripts_in_weechat]]
== WeeChat のスクリプト
// TRANSLATION MISSING
[[weechat_architecture]]
=== WeeChat architecture
WeeChat is single-threaded, and this applies to scripts as well.
The code of a script is executed:
* when the script is loaded: typically a call to the
<<register_function,register function>>
* when a hook callback is called by WeeChat (see the chapter <<hooks,フック>>).
When the code of a script is executed, WeeChat waits for the end of execution
before going on. Therefore the script must *NOT* do blocking operations like
network calls without using a dedicated API function like `hook_process`.
[IMPORTANT]
A script must *NEVER* fork or create threads without using a dedicated API
function, this can crash WeeChat. +
If something must be run in background, the function `hook_process` can be used.
See example in the chapter <<hook_process,バックグラウンドプロセスの実行>>
and the documentation on the function `hook_process` in the
link:weechat_plugin_api.ja.html#_hook_process[WeeChat プラグイン API リファレンス].
[[languages_specificities]]
=== 言語仕様
+24
View File
@@ -45,6 +45,30 @@ ale API jest takie same dla wszystkich języków.
[[scripts_in_weechat]]
== Skrypty w WeeChat
// TRANSLATION MISSING
[[weechat_architecture]]
=== WeeChat architecture
WeeChat is single-threaded, and this applies to scripts as well.
The code of a script is executed:
* when the script is loaded: typically a call to the
<<register_function,register function>>
* when a hook callback is called by WeeChat (see the chapter <<hooks,Hooks>>).
When the code of a script is executed, WeeChat waits for the end of execution
before going on. Therefore the script must *NOT* do blocking operations like
network calls without using a dedicated API function like `hook_process`.
[IMPORTANT]
A script must *NEVER* fork or create threads without using a dedicated API
function, this can crash WeeChat. +
If something must be run in background, the function `hook_process` can be used.
See example in the chapter <<hook_process,Wykonuje proces w tle>>
and the documentation on the function `hook_process` in the
link:weechat_plugin_api.en.html#_hook_process[Opisu API wtyczek WeeChat] (Angielski).
[[languages_specificities]]
=== Specyfika języków