core: display more verbose debug with two "-d" in command /eval
Now a single -d in command /eval shows less debug messages than previous versions. To get the same debug messages than previous versions, two -d must be used.
This commit is contained in:
parent
33c7b96146
commit
2ad3da03a2
@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
New features::
|
||||
|
||||
* core: display more verbose debug with two "-d" in command /eval
|
||||
* core: add options "setvar" and "delvar" in command /buffer, rename option "localvar" to "listvar"
|
||||
* core: add buffer local variable "completion_default_template" (evaluated) to override the value of option "weechat.completion.default_template" (issue #1600)
|
||||
* core: add option "recreate" in command /filter
|
||||
|
@ -1302,80 +1302,80 @@ infolists: zeigt Information über die Infolists an
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
[-n] [-d] -c <expression1> <operator> <expression2>
|
||||
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
|
||||
|
||||
-n: gibt das Ergebnis aus, ohne dass dieses in den Buffer gesendet wird (debug Modus)
|
||||
-s: teilt Ausdrücke, bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden)
|
||||
-d: eine Debug-Ausgabe nach Auswertung anzeigen
|
||||
-c: Auswertung als Bedingung: nutzt Operatoren und runde Klammern, Rückgabewert als Boolean-Wert ("0" oder "1")
|
||||
expression: Ausdruck welcher verarbeitet werden soll. Variablen im Format ${variable} werden ersetzt (siehe unten); mehrere Befehle werden durch ein Semikolon voneinander getrennt
|
||||
operator: ein logischer oder vergleichender Operand:
|
||||
- logische Operanden:
|
||||
&& boolean "und"
|
||||
|| boolean "oder"
|
||||
- vergleichende Operanden:
|
||||
== gleich
|
||||
!= ungleich
|
||||
<= kleiner oder gleich
|
||||
< kleiner
|
||||
>= größer oder gleich
|
||||
> größer
|
||||
=~ stimmt mit regulärem POSIX Ausdruck überein
|
||||
!~ stimmt NICHT mit regulärem POSIX Ausdruck überein
|
||||
==* stimmt mit Maske überein (Platzhalter "*" ist erlaubt)
|
||||
!!* stimmt mit Maske NICHT überein (Platzhalter "*" ist erlaubt)
|
||||
=* stimmt mit Maske überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
|
||||
!* stimmt mit Maske NICHT überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
|
||||
==- ist enthalten, Groß- und Kleinschreibung wird beachtet
|
||||
!!- ist NICHT enthalten, Groß- und Kleinschreibung wird beachtet
|
||||
=- ist enthalten, Groß- und Kleinschreibung wird nicht beachtet
|
||||
!- ist NICHT enthalten, Groß- und Kleinschreibung wird nicht beachtet
|
||||
-n: display result without sending it to buffer (debug mode)
|
||||
-s: split expression before evaluating it (many commands can be separated by semicolons)
|
||||
-d: display debug output after evaluation (with two -d: more verbose debug)
|
||||
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
|
||||
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
|
||||
operator: a logical or comparison operator:
|
||||
- logical operators:
|
||||
&& boolean "and"
|
||||
|| boolean "or"
|
||||
- comparison operators:
|
||||
== equal
|
||||
!= not equal
|
||||
<= less or equal
|
||||
< less
|
||||
>= greater or equal
|
||||
> greater
|
||||
=~ is matching POSIX extended regex
|
||||
!~ is NOT matching POSIX extended regex
|
||||
==* is matching mask, case sensitive (wildcard "*" is allowed)
|
||||
!!* is NOT matching mask, case sensitive (wildcard "*" is allowed)
|
||||
=* is matching mask, case insensitive (wildcard "*" is allowed)
|
||||
!* is NOT matching mask, case insensitive (wildcard "*" is allowed)
|
||||
==- is included, case sensitive
|
||||
!!- is NOT included, case sensitive
|
||||
=- is included, case insensitive
|
||||
!- is NOT included, case insensitive
|
||||
|
||||
Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, nicht leer und von "0" abweichend ist.
|
||||
Für einen Vergleich werden Fließkommazahlen genutzt, insofern es sich bei beiden Ausdrücken um gültige Zahlen handelt, folgende Formate werden unterstützt:
|
||||
- Integer (Beispiele: 5, -7)
|
||||
- Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2)
|
||||
- hexadezimale Zahl (Beispiele: 0xA3, -0xA3)
|
||||
Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel:
|
||||
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
|
||||
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
|
||||
- integer (examples: 5, -7)
|
||||
- floating point number (examples: 5.2, -7.5, 2.83e-2)
|
||||
- hexadecimal number (examples: 0xA3, -0xA3)
|
||||
To force a string comparison, you can add double quotes around each expression, for example:
|
||||
50 > 100 ==> 0
|
||||
"50" > "100" ==> 1
|
||||
|
||||
Einige Variablen werden im Ausdruck mittels der Formatierung ${variable} ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität:
|
||||
1. eine evaluierte Teilzeichenkette (Format: "eval:xxx")
|
||||
2. eine evaluierte Bedingung (Format: "eval_cond:xxx")
|
||||
3. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx")
|
||||
4. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette")
|
||||
5. eine Zeichenkette mit einer maximalen Anzahl an Zeichen (Format: "cut:+Max,Suffix,Zeichenkette")
|
||||
oder maximale Anzahl an Zeichen die auf dem Bildschirm angezeigt werden sollen (Format: "cutscr:Max,Suffix,Zeichenkette oder "cutscr:+Max,Suffix,Zeichenkette")
|
||||
6. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx")
|
||||
7. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette")
|
||||
8. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx")
|
||||
9. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")
|
||||
10. ein Modifizierer (Format: "info:Name,Argumente", Argumente sind optional)
|
||||
11. eine Info (Format: "Info:Name,Argumente", Argumente sind optional)
|
||||
12. eine Basis 16/32/64 kodierte / dekodierte Zeichenfolge (Format: "base_encode:base,xxx" oder "base_decode:base,xxx")
|
||||
13. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
|
||||
14. eine Umgebungsvariable (Format: "env:XXX")
|
||||
15. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
|
||||
16. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx")
|
||||
17. eine Option (Format: "file.section.option")
|
||||
18. eine lokale Variable eines Buffers
|
||||
19. ein(e) hdata - Name/Variable (der Wert wird automatisch in eine Zeichenkette konvertiert), standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet.
|
||||
Das Format für hdata kann wie folgt aufgebaut sein:
|
||||
hdata.var1.var2...: startet mit hdata (der Pointer muss bekannt sein) und fragt eine Variable nach der anderen ab (weitere hdata können folgen)
|
||||
hdata[list].var1.var2...: startet hdata mittels einer Liste, zum Beispiel:
|
||||
${buffer[gui_buffers].full_name}: der vollständige Name des ersten Buffers, in der verknüpften Liste aller Buffer
|
||||
${plugin[weechat_plugins].name}: Name der ersten Erweiterung, in der verknüpften Liste aller Erweiterungen
|
||||
hdata[pointer].var1.var2...: startet hdata mittels einem Pointer, zum Beispiel:
|
||||
${buffer[0x1234abcd].full_name}: vollständiger Name eines Buffers und des dazugehörigen Pointers (kann in triggern benutzt werden)
|
||||
Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben
|
||||
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
|
||||
1. an evaluated sub-string (format: "eval:xxx")
|
||||
2. an evaluated condition (format: "eval_cond:xxx")
|
||||
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
|
||||
4. a string with chars to hide (format: "hide:char,string")
|
||||
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
|
||||
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
|
||||
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
|
||||
7. a repeated string (format: "repeat:count,string")
|
||||
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
|
||||
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
|
||||
10. a modifier (format: "modifier:name,data,string")
|
||||
11. an info (format: "info:name,arguments", arguments are optional)
|
||||
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
|
||||
13. current date/time (format: "date" or "date:format")
|
||||
14. an environment variable (format: "env:XXX")
|
||||
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
|
||||
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
|
||||
17. an option (format: "file.section.option")
|
||||
18. a local variable in buffer
|
||||
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
|
||||
Format for hdata can be one of following:
|
||||
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
|
||||
hdata[list].var1.var2...: start with a hdata using a list, for example:
|
||||
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
|
||||
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
|
||||
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
|
||||
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
|
||||
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
|
||||
|
||||
Beispiele (einfache Zeichenketten):
|
||||
Examples (simple strings):
|
||||
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
|
||||
/eval -n ${info:version} ==> 0.4.3
|
||||
/eval -n ${env:HOME} ==> /home/user
|
||||
/eval -n ${weechat.look.scroll_amount} ==> 3
|
||||
/eval -n ${sec.data.freenode_password} ==> geheim
|
||||
/eval -n ${sec.data.freenode_password} ==> secret
|
||||
/eval -n ${window} ==> 0x2549aa0
|
||||
/eval -n ${window.buffer} ==> 0x2549320
|
||||
/eval -n ${window.buffer.full_name} ==> core.weechat
|
||||
@ -1393,17 +1393,17 @@ Beispiele (einfache Zeichenketten):
|
||||
/eval -n ${base_encode:64,test} ==> dGVzdA==
|
||||
/eval -n ${base_decode:64,dGVzdA==} ==> test
|
||||
|
||||
Beispiele (Bedingungen):
|
||||
/eval -n -c ${window.buffer.number} > 2 ==> 0
|
||||
/eval -n -c ${window.win_width} > 100 ==> 1
|
||||
/eval -n -c (8 > 12) || (5 > 2) ==> 1
|
||||
/eval -n -c (8 > 12) && (5 > 2) ==> 0
|
||||
/eval -n -c abcd =~ ^ABC ==> 1
|
||||
/eval -n -c abcd =~ (?-i)^ABC ==> 0
|
||||
/eval -n -c abcd =~ (?-i)^abc ==> 1
|
||||
/eval -n -c abcd !~ abc ==> 0
|
||||
/eval -n -c abcd =* a*d ==> 1
|
||||
/eval -n -c abcd =- bc ==> 1
|
||||
Examples (conditions):
|
||||
/eval -n -c ${window.buffer.number} > 2 ==> 0
|
||||
/eval -n -c ${window.win_width} > 100 ==> 1
|
||||
/eval -n -c (8 > 12) || (5 > 2) ==> 1
|
||||
/eval -n -c (8 > 12) && (5 > 2) ==> 0
|
||||
/eval -n -c abcd =~ ^ABC ==> 1
|
||||
/eval -n -c abcd =~ (?-i)^ABC ==> 0
|
||||
/eval -n -c abcd =~ (?-i)^abc ==> 1
|
||||
/eval -n -c abcd !~ abc ==> 0
|
||||
/eval -n -c abcd =* a*d ==> 1
|
||||
/eval -n -c abcd =- bc ==> 1
|
||||
----
|
||||
|
||||
[[command_weechat_filter]]
|
||||
|
@ -1302,11 +1302,11 @@ infolists: display infos about infolists
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
[-n] [-d] -c <expression1> <operator> <expression2>
|
||||
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
|
||||
|
||||
-n: display result without sending it to buffer (debug mode)
|
||||
-s: split expression before evaluating it (many commands can be separated by semicolons)
|
||||
-d: display debug output after evaluation
|
||||
-d: display debug output after evaluation (with two -d: more verbose debug)
|
||||
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
|
||||
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
|
||||
operator: a logical or comparison operator:
|
||||
|
@ -2246,6 +2246,10 @@ Arguments:
|
||||
** _regex_replace_: the replacement text to use with _regex_, to replace
|
||||
text in _expr_ (the _regex_replace_ is evaluated on each match of _regex_
|
||||
against _expr_, until no match is found)
|
||||
** _debug_: debug level (string with integer number ≥ 1), if enabled, a key
|
||||
"debug_output" is added in hashtable _options_:
|
||||
*** _1_: enable debug
|
||||
*** _2_: enable more verbose debug
|
||||
|
||||
Return value:
|
||||
|
||||
|
@ -1301,12 +1301,12 @@ infolists : afficher des infos sur les infolists
|
||||
* `+eval+`: évaluer une expression
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
/eval [-n|-s] [-d [-d]] <expression>
|
||||
[-n] [-d] -c <expression1> <opérateur> <expression2>
|
||||
|
||||
-n : afficher le résultat sans envoyer au tampon (mode debug)
|
||||
-s : découper l'expression avant de l'évaluer (plusieurs commandes peuvent être séparées par des points-virgules)
|
||||
-d : afficher la sortie de debug après l'évaluation
|
||||
-d : afficher la sortie de debug après l'évaluation (avec deux -d : mode debug plus verbeux)
|
||||
-c : évaluer comme une condition : utiliser les opérateurs et les parenthèses, retourner une valeur booléenne ("0" ou "1")
|
||||
expression : expression à évaluer, les variables avec le format ${variable} sont remplacées (voir ci-dessous) ; plusieurs commandes peuvent être séparées par des points-virgules
|
||||
opérateur : un opérateur logique ou de comparaison :
|
||||
|
@ -2288,6 +2288,10 @@ Paramètres :
|
||||
remplacer du texte dans _expr_ (_regex_replace_ est évalué sur chaque
|
||||
correspondance de _regex_ sur _expr_, jusqu'à ce que plus aucune
|
||||
correspondance ne soit trouvée)
|
||||
** _debug_ : niveau de debug (chaîne avec un nombre entier ≥ 1), si activé,
|
||||
une clé "debug_output" est ajoutée dans la table de hachage _options_ :
|
||||
*** _1_ : activer le debug
|
||||
*** _2_ : activer le debug plus verbeux
|
||||
|
||||
Valeur de retour :
|
||||
|
||||
|
@ -1302,11 +1302,11 @@ infolists: display infos about infolists
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
[-n] [-d] -c <expression1> <operator> <expression2>
|
||||
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
|
||||
|
||||
-n: display result without sending it to buffer (debug mode)
|
||||
-s: split expression before evaluating it (many commands can be separated by semicolons)
|
||||
-d: display debug output after evaluation
|
||||
-d: display debug output after evaluation (with two -d: more verbose debug)
|
||||
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
|
||||
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
|
||||
operator: a logical or comparison operator:
|
||||
|
@ -2345,6 +2345,11 @@ Argomenti:
|
||||
** _regex_replace_: the replacement text to use with _regex_, to replace
|
||||
text in _expr_ (the _regex_replace_ is evaluated on each match of _regex_
|
||||
against _expr_, until no match is found)
|
||||
// TRANSLATION MISSING
|
||||
** _debug_: debug level (string with integer number ≥ 1), if enabled, a key
|
||||
"debug_output" is added in hashtable _options_:
|
||||
*** _1_: enable debug
|
||||
*** _2_: enable more verbose debug
|
||||
|
||||
Valore restituito:
|
||||
|
||||
|
@ -1302,11 +1302,11 @@ infolists: インフォリストに関する情報を表示
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
[-n] [-d] -c <expression1> <operator> <expression2>
|
||||
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
|
||||
|
||||
-n: display result without sending it to buffer (debug mode)
|
||||
-s: split expression before evaluating it (many commands can be separated by semicolons)
|
||||
-d: display debug output after evaluation
|
||||
-d: display debug output after evaluation (with two -d: more verbose debug)
|
||||
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
|
||||
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
|
||||
operator: a logical or comparison operator:
|
||||
|
@ -2262,6 +2262,11 @@ char *weechat_string_eval_expression (const char *expr,
|
||||
** _regex_replace_: _regex_ と一緒に使われる置換テキスト、_expr_
|
||||
に含まれるテキストを置換する (_regex_replace_ は、_expr_ 内で
|
||||
_regex_ 引数にマッチする部分が見つからなくなるまで、毎回評価されます)
|
||||
// TRANSLATION MISSING
|
||||
** _debug_: debug level (string with integer number ≥ 1), if enabled, a key
|
||||
"debug_output" is added in hashtable _options_:
|
||||
*** _1_: enable debug
|
||||
*** _2_: enable more verbose debug
|
||||
|
||||
戻り値:
|
||||
|
||||
|
@ -1300,82 +1300,81 @@ infolists: wyświetla informacje o infolistach
|
||||
* `+eval+`: przetwórz wyrażenie
|
||||
|
||||
----
|
||||
/eval [-n|-s] [-d] <wyrażenie>
|
||||
[-n] [-d ] -c <wyrażenie1> <operator> <wyrażenie2>
|
||||
/eval [-n|-s] [-d] <expression>
|
||||
[-n] [-d [-d]] -c <expression1> <operator> <expression2>
|
||||
|
||||
-n: wyświetla wynik bez wysyłania go do buforu (tryb debugowania)
|
||||
-s: podziel wyrażenie przed przetworzeniem go (wiele komend może być oddzielonych średnikami)
|
||||
-d: wyświetl wyjście debugowe po ewaluacji
|
||||
-c: przetwarza jako warunek: użyj operatorów i nawiasów, zwraca wartość logiczną ("0" lub "1")
|
||||
wyrażenie: wyrażenie do przetworzenia, zmienne o formacie ${zmienna} są zastępowane (zobacz niżej); wiele komend można oddzielić średnikami
|
||||
operator: operator logiczny lub porównania:
|
||||
- operatory logiczne:
|
||||
&& logiczne "i"
|
||||
|| logiczne "lub"
|
||||
- operatory porównania:
|
||||
== równy
|
||||
!= różny
|
||||
<= mniejszy lub równy
|
||||
< mniejszy
|
||||
>= większy lub równy
|
||||
> większy
|
||||
=~ pasuje do rozszerzonego wyrażenia regularnego POSIX
|
||||
!~ NIE pasuje do rozszerzonego wyrażenia regularnego POSIX
|
||||
-n: display result without sending it to buffer (debug mode)
|
||||
-s: split expression before evaluating it (many commands can be separated by semicolons)
|
||||
-d: display debug output after evaluation (with two -d: more verbose debug)
|
||||
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
|
||||
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
|
||||
operator: a logical or comparison operator:
|
||||
- logical operators:
|
||||
&& boolean "and"
|
||||
|| boolean "or"
|
||||
- comparison operators:
|
||||
== equal
|
||||
!= not equal
|
||||
<= less or equal
|
||||
< less
|
||||
>= greater or equal
|
||||
> greater
|
||||
=~ is matching POSIX extended regex
|
||||
!~ is NOT matching POSIX extended regex
|
||||
==* is matching mask, case sensitive (wildcard "*" is allowed)
|
||||
!!* is NOT matching mask, case sensitive (wildcard "*" is allowed)
|
||||
=* is matching mask, case insensitive (wildcard "*" is allowed)
|
||||
!* is NOT matching mask, case insensitive (wildcard "*" is allowed)
|
||||
==- is included, case sensitive
|
||||
!!- is NOT included, case sensitive
|
||||
=- is included, case insensitive
|
||||
!- is NOT included, case insensitive
|
||||
|
||||
==* pasuje do maski, rozróżnia wielkość znaków (dzika karta "*" dozwolona)
|
||||
!!* NIE pasuje do maski, rozróżnia wielkość znaków (dzika karta "*" dozwolona)
|
||||
=* pasuje do maski, nie rozróżnia wielkość znaków (dzika karta "*" dozwolona)
|
||||
!* NIE pasuje do maski, nie rozróżnia wielkość znaków (dzika karta "*" dozwolona)
|
||||
==- jest zawarte, rozróżnia wielkość znaków
|
||||
!!- NIE jest zawarte,rozróżnia wielkość znaków
|
||||
=- jest zawarte, nie rozróżnia wielkość znaków
|
||||
!- NIE jest zawarte, nie rozróżnia wielkość znaków
|
||||
|
||||
Wyrażenie jest uznawane za „prawdziwe” jeśli nie jest NULL, nie jest puste, oraz różni się od "0".
|
||||
Porównania dokonuje się z użyciem liczb całkowitych jeśli oba wyrażenia są liczbami całkowitymi, w jednym z następujących formatów:
|
||||
- liczby całkowite (przykłady: 5, -7)
|
||||
- liczby zmiennoprzecinkowe (przykłady: 5.2, -7.5, 2.83e-2)
|
||||
- liczby szesnastkowe (przykłady: 0xA3, -0xA3)
|
||||
W celu wymuszenia porównywania ciągów, należy umieścić każde wyrażenie w cudzysłowie, na przykład:
|
||||
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
|
||||
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
|
||||
- integer (examples: 5, -7)
|
||||
- floating point number (examples: 5.2, -7.5, 2.83e-2)
|
||||
- hexadecimal number (examples: 0xA3, -0xA3)
|
||||
To force a string comparison, you can add double quotes around each expression, for example:
|
||||
50 > 100 ==> 0
|
||||
"50" > "100" ==> 1
|
||||
|
||||
Niektóre zmienne w wyrażeniach są zamieniane, poprzez zastosowanie formatu ${zmienna}, według priorytetu zmienną może być:
|
||||
1. przetworzony ciąg (format: "eval:xxx")
|
||||
2. przetworzone wyrażenie (format: "eval_cond:xxx")
|
||||
3. ciąg z wyescapowanymi znakami (format: "esc:xxx" lub "\xxx")
|
||||
4. ciąg ze znakami do ukrycia (format: "hide:char,string")
|
||||
5. ciąg o maksymalnej długości (format: "cut:max,suffix,string" lub "cut:+max,suffix,string")
|
||||
lub maksymalna ilość znaków wyświetlanych na ekranie (format: "cutscr:max,suffix,string" lub "cutscr:+max,suffix,string")
|
||||
6. odwrócony ciąg (format: "rev:xxx")
|
||||
7. powtórzony ciąg (format: "repeat:ilość,ciąg")
|
||||
8. długość ciągu (format: "length:xxx" or "lengthscr:xxx")
|
||||
9. kolor (format "color:xxx", zobacz „Opis API wtyczek”, funkcja "color")
|
||||
10. modyfikator (format: "modifier:name,data,string")
|
||||
11. informacja (format: "info:nazwa,argumenty", argumenty są opcjonalne)
|
||||
12. ciąg zakodowany/zdekodowany z base 16/32/64 (format: "base_encode:base,xxx" lub "base_decode:base,xxx")
|
||||
13. obecna data/czas (format: "date" lub "date:format")
|
||||
14. zmienna środowiskowa (format: "env:XXX")
|
||||
15. wyrażenie warunkowe (format: "if:condition?value_if_true:value_if_false")
|
||||
16. wynik wyrażenia z nawiasami i operatorami + - * / // % ** (format: "calc:xxx")
|
||||
17. opcja (format: plik.sekcja.opcja)
|
||||
18 zmienna lokalna w buforze
|
||||
19. nazwa hdatay/zmiennej (wartość jest automatycznie konwertowana na ciąg znaków), domyślnie "window" i "buffer" wskazują na aktualne okno/bufor.
|
||||
Format dla hdata może być jednym z poniższych:
|
||||
hdata.zmienna1.zmienna2...: inicjuje hdata (wskaźnik musi być znany), następnie wypytuje zmienne jedna po drugiej (inne hdata mogą być następne)
|
||||
hdata[list].zmienna1.zmienna2...: inicjuje hdata z wykorzystaniem listy, na przykład:
|
||||
${buffer[gui_buffers].full_name}: pełna nazwa buforu w połączonej liście buforów
|
||||
${plugin[weechat_plugins].name}: nazwa pierwszej wtyczki w połączonej liście wtyczek
|
||||
hdata[wskaźnik].zmienna1.zmienna2...: zacznij z hdata używając wskaźnika, na przykład:
|
||||
${buffer[0x1234abcd].full_name}: pełna nazwa buforu z tym wskaźnikiem (może zostać użyte w triggerach)
|
||||
Nazwy hdata i zmiennych, można znaleźć w „Opisie API wtyczek”, funkcja "weechat_hdata_get".
|
||||
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
|
||||
1. an evaluated sub-string (format: "eval:xxx")
|
||||
2. an evaluated condition (format: "eval_cond:xxx")
|
||||
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
|
||||
4. a string with chars to hide (format: "hide:char,string")
|
||||
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
|
||||
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
|
||||
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
|
||||
7. a repeated string (format: "repeat:count,string")
|
||||
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
|
||||
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
|
||||
10. a modifier (format: "modifier:name,data,string")
|
||||
11. an info (format: "info:name,arguments", arguments are optional)
|
||||
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
|
||||
13. current date/time (format: "date" or "date:format")
|
||||
14. an environment variable (format: "env:XXX")
|
||||
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
|
||||
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
|
||||
17. an option (format: "file.section.option")
|
||||
18. a local variable in buffer
|
||||
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
|
||||
Format for hdata can be one of following:
|
||||
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
|
||||
hdata[list].var1.var2...: start with a hdata using a list, for example:
|
||||
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
|
||||
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
|
||||
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
|
||||
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
|
||||
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
|
||||
|
||||
Przykłady (proste ciągi):
|
||||
Examples (simple strings):
|
||||
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
|
||||
/eval -n ${info:version} ==> 0.4.3
|
||||
/eval -n ${env:HOME} ==> /home/user
|
||||
/eval -n ${weechat.look.scroll_amount} ==> 3
|
||||
/eval -n ${sec.data.freenode_password} ==> secret
|
||||
/eval -n ${sec.data.freenode_password} ==> secret
|
||||
/eval -n ${window} ==> 0x2549aa0
|
||||
/eval -n ${window.buffer} ==> 0x2549320
|
||||
/eval -n ${window.buffer.full_name} ==> core.weechat
|
||||
@ -1393,7 +1392,7 @@ Przykłady (proste ciągi):
|
||||
/eval -n ${base_encode:64,test} ==> dGVzdA==
|
||||
/eval -n ${base_decode:64,dGVzdA==} ==> test
|
||||
|
||||
Przykłady (warunki):
|
||||
Examples (conditions):
|
||||
/eval -n -c ${window.buffer.number} > 2 ==> 0
|
||||
/eval -n -c ${window.win_width} > 100 ==> 1
|
||||
/eval -n -c (8 > 12) || (5 > 2) ==> 1
|
||||
@ -1403,6 +1402,7 @@ Przykłady (warunki):
|
||||
/eval -n -c abcd =~ (?-i)^abc ==> 1
|
||||
/eval -n -c abcd !~ abc ==> 0
|
||||
/eval -n -c abcd =* a*d ==> 1
|
||||
/eval -n -c abcd =- bc ==> 1
|
||||
----
|
||||
|
||||
[[command_weechat_filter]]
|
||||
|
7
po/cs.po
7
po/cs.po
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1544,7 +1544,7 @@ msgstr "vyhodnotit výraz"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr "[-n|-s] <výraz> || [-n] -c <výraz1> <operátor> <výraz2>"
|
||||
|
||||
@ -1552,7 +1552,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
9
po/de.po
9
po/de.po
@ -24,7 +24,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-12-21 13:06+0100\n"
|
||||
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
|
||||
"Language-Team: German <kde-i18n-de@kde.org>\n"
|
||||
@ -1681,18 +1681,21 @@ msgstr ""
|
||||
msgid "evaluate expression"
|
||||
msgstr "evaluierter Ausdruck"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/es.po
7
po/es.po
@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1574,7 +1574,7 @@ msgid "evaluate expression"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
|
||||
@ -1582,7 +1582,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
14
po/fr.po
14
po/fr.po
@ -21,8 +21,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"PO-Revision-Date: 2020-12-19 18:18+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-12-31 18:54+0100\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: fr\n"
|
||||
@ -1656,17 +1656,18 @@ msgid "evaluate expression"
|
||||
msgstr "évaluer une expression"
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <opérateur> "
|
||||
"[-n|-s] [-d [-d]] <expression> || [-n] [-d] -c <expression1> <opérateur> "
|
||||
"<expression2>"
|
||||
|
||||
msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
@ -1792,7 +1793,8 @@ msgstr ""
|
||||
" -n : afficher le résultat sans envoyer au tampon (mode debug)\n"
|
||||
" -s : découper l'expression avant de l'évaluer (plusieurs commandes "
|
||||
"peuvent être séparées par des points-virgules)\n"
|
||||
" -d : afficher la sortie de debug après l'évaluation\n"
|
||||
" -d : afficher la sortie de debug après l'évaluation (avec deux -d : "
|
||||
"mode debug plus verbeux)\n"
|
||||
" -c : évaluer comme une condition : utiliser les opérateurs et les "
|
||||
"parenthèses, retourner une valeur booléenne (\"0\" ou \"1\")\n"
|
||||
"expression : expression à évaluer, les variables avec le format ${variable} "
|
||||
|
7
po/hu.po
7
po/hu.po
@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1462,7 +1462,7 @@ msgid "evaluate expression"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
|
||||
@ -1470,7 +1470,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/it.po
7
po/it.po
@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1555,7 +1555,7 @@ msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
"[-n] <espressione> || [-n] -c <espressione1> <operatore> <espressione2>"
|
||||
@ -1565,7 +1565,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/ja.po
7
po/ja.po
@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
|
||||
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
|
||||
@ -1613,7 +1613,7 @@ msgstr "式を評価"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
|
||||
|
||||
@ -1622,7 +1622,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
9
po/pl.po
9
po/pl.po
@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-12-27 19:05+0100\n"
|
||||
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
|
||||
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
|
||||
@ -1649,18 +1649,21 @@ msgstr ""
|
||||
msgid "evaluate expression"
|
||||
msgstr "przetwórz wyrażenie"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
"[-n|-s] [-d] <wyrażenie> || [-n] [-d ] -c <wyrażenie1> <operator> "
|
||||
"<wyrażenie2>"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/pt.po
7
po/pt.po
@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
|
||||
"Language-Team: Portuguese <>\n"
|
||||
@ -1615,7 +1615,7 @@ msgstr "avaliar uma expressão"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr "[-n|-s] <expressão> || [-n] -c <expressão1> <operador> <expressão2>"
|
||||
|
||||
@ -1624,7 +1624,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-18 11:34+0200\n"
|
||||
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1620,7 +1620,7 @@ msgstr "avaliar expressão"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
|
||||
|
||||
@ -1628,7 +1628,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/ru.po
7
po/ru.po
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
|
||||
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1484,7 +1484,7 @@ msgid "evaluate expression"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
|
||||
@ -1492,7 +1492,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
7
po/tr.po
7
po/tr.po
@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
|
||||
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1315,7 +1315,7 @@ msgid "evaluate expression"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
|
||||
@ -1323,7 +1323,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2020-12-19 18:17+0100\n"
|
||||
"POT-Creation-Date: 2020-12-31 18:53+0100\n"
|
||||
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@ -1317,7 +1317,7 @@ msgid "evaluate expression"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
|
||||
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
|
||||
"<expression2>"
|
||||
msgstr ""
|
||||
|
||||
@ -1325,7 +1325,8 @@ msgid ""
|
||||
" -n: display result without sending it to buffer (debug mode)\n"
|
||||
" -s: split expression before evaluating it (many commands can be "
|
||||
"separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation (with two -d: more verbose "
|
||||
"debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, return a "
|
||||
"boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format ${variable} are "
|
||||
|
@ -2023,7 +2023,7 @@ COMMAND_CALLBACK(debug)
|
||||
COMMAND_CALLBACK(eval)
|
||||
{
|
||||
int i, print_only, split_command, condition, debug, error;
|
||||
char *result, *ptr_args, **commands;
|
||||
char *result, *ptr_args, **commands, str_debug[32];
|
||||
const char **debug_output;
|
||||
struct t_hashtable *pointers, *options;
|
||||
|
||||
@ -2060,7 +2060,7 @@ COMMAND_CALLBACK(eval)
|
||||
}
|
||||
else if (string_strcasecmp (argv[i], "-d") == 0)
|
||||
{
|
||||
debug = 1;
|
||||
debug++;
|
||||
ptr_args = argv_eol[i + 1];
|
||||
}
|
||||
else
|
||||
@ -2096,8 +2096,11 @@ COMMAND_CALLBACK(eval)
|
||||
{
|
||||
if (condition)
|
||||
hashtable_set (options, "type", "condition");
|
||||
if (debug)
|
||||
hashtable_set (options, "debug", "1");
|
||||
if (debug > 0)
|
||||
{
|
||||
snprintf (str_debug, sizeof (str_debug), "%d", debug);
|
||||
hashtable_set (options, "debug", str_debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7459,12 +7462,13 @@ command_init ()
|
||||
NULL, "eval",
|
||||
N_("evaluate expression"),
|
||||
N_("[-n|-s] [-d] <expression>"
|
||||
" || [-n] [-d] -c <expression1> <operator> <expression2>"),
|
||||
" || [-n] [-d [-d]] -c <expression1> <operator> <expression2>"),
|
||||
N_(" -n: display result without sending it to buffer "
|
||||
"(debug mode)\n"
|
||||
" -s: split expression before evaluating it "
|
||||
"(many commands can be separated by semicolons)\n"
|
||||
" -d: display debug output after evaluation\n"
|
||||
" -d: display debug output after evaluation "
|
||||
"(with two -d: more verbose debug)\n"
|
||||
" -c: evaluate as condition: use operators and parentheses, "
|
||||
"return a boolean value (\"0\" or \"1\")\n"
|
||||
"expression: expression to evaluate, variables with format "
|
||||
|
@ -46,8 +46,8 @@
|
||||
#include "../plugins/plugin.h"
|
||||
|
||||
|
||||
#define EVAL_DEBUG(msg, argz...) \
|
||||
if (eval_context->debug) \
|
||||
#define EVAL_DEBUG(level, msg, argz...) \
|
||||
if (eval_context->debug_level >= level) \
|
||||
eval_debug_message (eval_context, msg, ##argz);
|
||||
|
||||
char *logical_ops[EVAL_NUM_LOGICAL_OPS] =
|
||||
@ -125,7 +125,7 @@ eval_strstr_level (const char *string, const char *search,
|
||||
int level, length_search;
|
||||
int length_prefix, length_prefix2, length_suffix, length_suffix2;
|
||||
|
||||
EVAL_DEBUG("eval_strstr_level(\"%s\", \"%s\", \"%s\", \"%s\", %d)",
|
||||
EVAL_DEBUG(2, "eval_strstr_level(\"%s\", \"%s\", \"%s\", \"%s\", %d)",
|
||||
string, search, extra_prefix, extra_suffix, escape);
|
||||
|
||||
if (!string || !search)
|
||||
@ -676,7 +676,7 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path,
|
||||
int type;
|
||||
struct t_hashtable *hashtable;
|
||||
|
||||
EVAL_DEBUG("eval_hdata_get_value(\"%s\", 0x%lx, \"%s\")",
|
||||
EVAL_DEBUG(1, "eval_hdata_get_value(\"%s\", 0x%lx, \"%s\")",
|
||||
hdata->name, pointer, path);
|
||||
|
||||
value = NULL;
|
||||
@ -958,7 +958,7 @@ eval_replace_vars_cb (void *data, const char *text)
|
||||
|
||||
eval_context = (struct t_eval_context *)data;
|
||||
|
||||
EVAL_DEBUG("eval_replace_vars_cb(\"%s\")", text);
|
||||
EVAL_DEBUG(1, "eval_replace_vars_cb(\"%s\")", text);
|
||||
|
||||
/* 1. variable in hashtable "extra_vars" */
|
||||
if (eval_context->extra_vars)
|
||||
@ -1148,7 +1148,7 @@ eval_replace_vars (const char *expr, struct t_eval_context *eval_context)
|
||||
const char *no_replace_prefix_list[] = { "if:", NULL };
|
||||
char *result;
|
||||
|
||||
EVAL_DEBUG("eval_replace_vars(\"%s\")", expr);
|
||||
EVAL_DEBUG(1, "eval_replace_vars(\"%s\")", expr);
|
||||
|
||||
eval_context->recursion_count++;
|
||||
|
||||
@ -1195,7 +1195,7 @@ eval_compare (const char *expr1, int comparison, const char *expr2,
|
||||
double value1, value2;
|
||||
char *error;
|
||||
|
||||
EVAL_DEBUG("eval_compare(\"%s\", \"%s\", \"%s\")",
|
||||
EVAL_DEBUG(1, "eval_compare(\"%s\", \"%s\", \"%s\")",
|
||||
expr1, comparisons[comparison], expr2);
|
||||
|
||||
rc = 0;
|
||||
@ -1328,7 +1328,7 @@ eval_expression_condition (const char *expr,
|
||||
const char *pos, *pos_end;
|
||||
char *expr2, *sub_expr, *value, *tmp_value, *tmp_value2;
|
||||
|
||||
EVAL_DEBUG("eval_expression_condition(\"%s\")", expr);
|
||||
EVAL_DEBUG(1, "eval_expression_condition(\"%s\")", expr);
|
||||
|
||||
value = NULL;
|
||||
|
||||
@ -1566,7 +1566,7 @@ eval_replace_regex (const char *string, regex_t *regex, const char *replace,
|
||||
int empty_replace_allowed;
|
||||
struct t_eval_regex eval_regex;
|
||||
|
||||
EVAL_DEBUG("eval_replace_regex(\"%s\", 0x%lx, \"%s\")",
|
||||
EVAL_DEBUG(1, "eval_replace_regex(\"%s\", 0x%lx, \"%s\")",
|
||||
string, regex, replace);
|
||||
|
||||
if (!string || !regex || !replace)
|
||||
@ -1714,7 +1714,8 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
struct t_eval_context context, *eval_context;
|
||||
int condition, rc, pointers_allocated, regex_allocated;
|
||||
int ptr_window_added, ptr_buffer_added;
|
||||
char *value;
|
||||
long number;
|
||||
char *value, *error;
|
||||
const char *default_prefix = EVAL_DEFAULT_PREFIX;
|
||||
const char *default_suffix = EVAL_DEFAULT_SUFFIX;
|
||||
const char *ptr_value, *regex_replace;
|
||||
@ -1758,6 +1759,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
eval_context->suffix = default_suffix;
|
||||
eval_context->regex = NULL;
|
||||
eval_context->recursion_count = 0;
|
||||
eval_context->debug_level = 0;
|
||||
eval_context->debug = NULL;
|
||||
|
||||
/*
|
||||
@ -1830,11 +1832,19 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
}
|
||||
|
||||
/* check for debug */
|
||||
if (hashtable_has_key (options, "debug"))
|
||||
eval_context->debug = string_dyn_alloc (256);
|
||||
ptr_value = hashtable_get (options, "debug");
|
||||
if (ptr_value && ptr_value[0])
|
||||
{
|
||||
number = strtol (ptr_value, &error, 10);
|
||||
if (error && !error[0] && (number >= 1))
|
||||
{
|
||||
eval_context->debug_level = (int)number;
|
||||
eval_context->debug = string_dyn_alloc (256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EVAL_DEBUG("eval_expression(\"%s\")", expr);
|
||||
EVAL_DEBUG(1, "eval_expression(\"%s\")", expr);
|
||||
|
||||
/* evaluate expression */
|
||||
if (condition)
|
||||
|
@ -71,14 +71,15 @@ struct t_eval_regex
|
||||
|
||||
struct t_eval_context
|
||||
{
|
||||
struct t_hashtable *pointers;
|
||||
struct t_hashtable *extra_vars;
|
||||
int extra_vars_eval;
|
||||
const char *prefix;
|
||||
const char *suffix;
|
||||
struct t_eval_regex *regex;
|
||||
int recursion_count;
|
||||
char **debug;
|
||||
struct t_hashtable *pointers; /* pointers used in eval */
|
||||
struct t_hashtable *extra_vars; /* extra variables used in eval */
|
||||
int extra_vars_eval; /* 1 if extra vars must be evaluated */
|
||||
const char *prefix; /* prefix (default is "${") */
|
||||
const char *suffix; /* suffix (default is "}") */
|
||||
struct t_eval_regex *regex; /* in case of replace with regex */
|
||||
int recursion_count; /* to prevent infinite recursion */
|
||||
int debug_level; /* 0: no debug, 1: debug, 2: extra */
|
||||
char **debug; /* not NULL if debug_level >= 1 */
|
||||
};
|
||||
|
||||
extern int eval_is_true (const char *value);
|
||||
|
@ -278,10 +278,25 @@ TEST(CoreEval, EvalCondition)
|
||||
hashtable_remove (options, "prefix");
|
||||
hashtable_remove (options, "suffix");
|
||||
|
||||
/* test with debug */
|
||||
/* test with debug level 1 */
|
||||
hashtable_set (options, "debug", "1");
|
||||
WEE_CHECK_EVAL("1", "abc < def");
|
||||
ptr_debug_output = (const char *)hashtable_get (options, "debug_output");
|
||||
STRCMP_EQUAL("eval_expression(\"abc < def\")\n"
|
||||
"eval_expression_condition(\"abc < def\")\n"
|
||||
"eval_expression_condition(\"abc\")\n"
|
||||
"eval_replace_vars(\"abc\")\n"
|
||||
"eval_expression_condition(\"def\")\n"
|
||||
"eval_replace_vars(\"def\")\n"
|
||||
"eval_compare(\"abc\", \"<\", \"def\")",
|
||||
ptr_debug_output);
|
||||
hashtable_remove (options, "debug");
|
||||
hashtable_remove (options, "debug_output");
|
||||
|
||||
/* test with debug level 2 */
|
||||
hashtable_set (options, "debug", "2");
|
||||
WEE_CHECK_EVAL("1", "abc < def");
|
||||
ptr_debug_output = (const char *)hashtable_get (options, "debug_output");
|
||||
STRCMP_EQUAL("eval_expression(\"abc < def\")\n"
|
||||
"eval_expression_condition(\"abc < def\")\n"
|
||||
"eval_strstr_level(\"abc < def\", \"||\", \"(\", \")\", 0)\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user