aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/kvs/KviKvsCoreFunctions_gl.cpp7
-rw-r--r--src/kvirc/kvs/parser/KviKvsParser.cpp22
-rw-r--r--src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp62
-rw-r--r--src/kvirc/ui/KviIrcView_events.cpp56
-rw-r--r--src/modules/system/Plugin.cpp58
5 files changed, 109 insertions, 96 deletions
diff --git a/src/kvirc/kvs/KviKvsCoreFunctions_gl.cpp b/src/kvirc/kvs/KviKvsCoreFunctions_gl.cpp
index ea204c6e5..617af10ce 100644
--- a/src/kvirc/kvs/KviKvsCoreFunctions_gl.cpp
+++ b/src/kvirc/kvs/KviKvsCoreFunctions_gl.cpp
@@ -46,7 +46,7 @@ namespace KviKvsCoreFunctions
/*
@doc: gender
@type:
- function
+ function
@title:
$gender
@short:
@@ -122,10 +122,11 @@ namespace KviKvsCoreFunctions
Returns an hashtable of all global variables set.
@examples:
[example]
- echo $globals()
- [example]
+ echo $globals
+ [/example]
@seealso:
[cmd]global[/cmd]
+ [cmd]unset[/cmd]
[fnc]$hash[/fnc]
*/
diff --git a/src/kvirc/kvs/parser/KviKvsParser.cpp b/src/kvirc/kvs/parser/KviKvsParser.cpp
index ebea3fba5..f8f28c988 100644
--- a/src/kvirc/kvs/parser/KviKvsParser.cpp
+++ b/src/kvirc/kvs/parser/KviKvsParser.cpp
@@ -1885,19 +1885,17 @@ KviKvsTreeNodeInstruction * KviKvsParser::parseAsParameter(const QChar * pBuffer
[/example]
[br]
[note]
- [br]
- [big]Food for thought:[/big]
- KVIrc allocates a pointer for each item in the array. The pointer is
- empty when the item is unset and points to an additional block
- of memory when the item is set. The size of a pointer is platform
- dependent: on the platforms supported by KVIrc it's either 32 or 64-bit.
- The size of the additional block depends both on the platform
- and on the contents of the item... it's average value may
- be around 16 bytes. The array size is determined by the last SET element index.
- All this this means that in the worst case (64 bit assumption) an array in
- that the highest indexed item set is N eats up at least N*8+16 bytes of memory.
+ [big]Food for thought:[/big]
+ KVIrc allocates a pointer for each item in the array. The pointer is
+ empty when the item is unset and points to an additional block
+ of memory when the item is set. The size of a pointer is platform
+ dependent: on the platforms supported by KVIrc it's either 32 or 64-bit.
+ The size of the additional block depends both on the platform
+ and on the contents of the item... it's average value may
+ be around 16 bytes. The array size is determined by the last SET element index.
+ All this this means that in the worst case (64 bit assumption) an array in
+ that the highest indexed item set is N eats up at least N*8+16 bytes of memory.
[/note]
- [br]
Besides the traditional indexed looping method you
can also use the [cmd]foreach[/cmd] command to iterate the items of an array.
Be aware that [cmd]foreach[/cmd] will [b]not[/b] iterate over unset items in the
diff --git a/src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp b/src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp
index 3a403f8ec..4d0bf98cb 100644
--- a/src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp
+++ b/src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp
@@ -292,15 +292,24 @@ KviKvsTreeNodeCommand * KviKvsParser::parseSpecialCommandGlobal()
@description:
Declares a list of global variables.
Once a variable has been declared as global
- it refers to the global KVIrc instance for the scope of the script.
+ it refers to the global KVIrc instance for the scope of the script.[br]
Global variables are shared between scripts and keep their
- value until they are explicitly unset or KVIrc quits.
+ value until they are explicitly [cmd]unset[/cmd] or KVIrc quits.[br]
This command can be used to override the default behaviour of
declaring global variables by starting them with an uppercase letter
- and declaring local variables by starting them with a lowercase one.
+ and declaring local variables by starting them with a lowercase one.[br][br]
+ In any particular instance instance where a global variable may interfere with desired operation,
+ you can specifically [b][cmd]unset[/cmd][/b] the desired variable.
@examples:
- global %a, %b, %c;
+ [example]
+ global %a, %b, %c;
+ [/example]
+ @seealso:
+ [fnc]$global[/fnc]
+ [cmd]unset[/cmd]
+ [fnc]$hash[/fnc]
*/
+
while(KVSP_curCharUnicode == '%')
{
KVSP_skipChar;
@@ -672,14 +681,14 @@ KviKvsTreeNodeCommand * KviKvsParser::parseSpecialCommandWhile()
causes the <condition> to be true, an empty hash causes it to be false.[br]
@examples:
[example]
- %i = 0;
- while(%i < 100)%i++
- while(%i > 0)
- {
- %i -= 10
- if(%i < 20)break;
- }
- echo %i
+ %i = 0;
+ while(%i < 100)%i++
+ while(%i > 0)
+ {
+ %i -= 10
+ if(%i < 20)break;
+ }
+ echo %i
[/example]
*/
@@ -870,23 +879,25 @@ KviKvsTreeNodeCommand * KviKvsParser::parseSpecialCommandIf()
@short:
Flow control command
@description:
- Executes <command1> if the <condition> evaluates
- to true (non zero result).
- If the [i]else part[/i] is given, <command2> is executed
- if the <condition> evaluates to false (result == '0').[br]
- <condition> is an expression evaluated in the same way as [doc:expressioneval]$(*)[/doc]
+ Executes <command1> if the <condition> evaluates to true (non zero result).[br]
+ If the [i]else part[/i] is given, <command2> is executed.[br]
+ If the <condition> evaluates to false (result == '0').[br]
+ the [b]<condition>[/b] is an expression evaluated in the same way as [doc:expressioneval]$(*)[/doc]
with the following extensions:[br]
- If <condition> is a string, its length is evaluated - in this way a non-empty string
+ If the [b]<condition>[/b] is a string, its length is evaluated - in this way a non-empty string
causes the <condition> to be true, and an empty string causes it to be false.[br]
- If <condition> is an array, its size is evaluated - a non-empty array
- is true, an empty array is false.[br]
- If <condition> is a hash, the number of its entries is evaluated - a non-empty hash
- is true, an empty hash is false.[br]
+ If the [b]<condition>[/b] is an array, its size is evaluated - a non-empty array is true, an empty array is false.[br]
+ If the [b]<condition>[/b] is a hash, the number of its entries is evaluated - a non-empty hash is true, an empty hash is false.[br]
@examples:
[example]
- if(%a != 10)[cmd]echo[/cmd] \%a was != 10
- else [cmd]echo[/cmd] \%a was 10!
+ if(%a != 10)
+ [cmd]echo[/cmd] \%a was != 10
+ else
+ [cmd]echo[/cmd] \%a was 10!
[/example]
+ @seealso:
+ [doc:expressioneval]Expression evaluation identifier[/doc]
+
*/
if(KVSP_curCharUnicode != '(')
@@ -1082,7 +1093,8 @@ KviKvsTreeNodeCommand * KviKvsParser::parseSpecialCommandFor()
causes the <condition> to be true, an empty hash causes it to be false.[br]
@examples:
[example]
- for(%a = 0;%a < 100;%a++)echo %a
+ for(%a = 0;%a < 100;%a++)
+ echo %a
[/example]
*/
diff --git a/src/kvirc/ui/KviIrcView_events.cpp b/src/kvirc/ui/KviIrcView_events.cpp
index 50b9a9afa..9f2197a6c 100644
--- a/src/kvirc/ui/KviIrcView_events.cpp
+++ b/src/kvirc/ui/KviIrcView_events.cpp
@@ -60,45 +60,51 @@
generic
@body:
The KVIrc view widgets support clickable links.[br]
- The links can be created using special escape sequences in the text
- passed to the [cmd]echo[/cmd] command.[br]
+ The links can be created using special escape sequences in the text passed to the [cmd]echo[/cmd] command.[br]
KVIrc uses some escape sequences in the text [i]echoed[/i] internally.[br]
The simplest way to explain it is to use an example:[br]
[example]
- [cmd]echo[/cmd] This is a [fnc]$cr[/fnc]![!dbl][cmd]echo[/cmd] You have clicked it![fnc]$cr[/fnc]\clickable link$cr !
+ echo This is a $cr![!dbl]echo You have clicked it! $cr\clickable link$cr !
[/example]
The example above will show the following text line: "This is a clickable link".
If you move the mouse over the words [i]clickable link[/i], you will see the text highlighted.[br]
Once you double-click one of that words, the command [i][cmd]echo[/cmd] You have clicked it![/i] will be executed.[br]
- The format looks complex ?... it is not...just read on.[br]
-
- <cr>!<link_type><cr><visible text><cr>
- <cr>!<escape_command><cr><visible text><cr>
-
+ The format looks complex?... it is not...just read on.[br]
+ [example]
+ <cr>!<link_type><cr><visible text><cr>[br]
+ <cr>!<escape_command><cr><visible text><cr>
+ [/example]
[big]Escape format[/big]
- The whole escape sequence format is the following:[br]
- [b]<cr>!<escape_command><cr><visible text><cr>[/b][br]
- <cr> is the carriage return character. You can obtain it by using the [fnc]]$cr[/fnc] function.[br]
- <visible text> is the text that will appear as [i]link[/i] when you move the mouse over it.[br]
- <escape_command> is the description of the actions to be taken when the user interacts with the link.[br]
- <escape_command> has the two following syntactic forms:[br]
- [b]<escape_command> ::= <user_defined_commands>[/b][br]
- [b]<escape_command> ::= <builtin_link_description>[/b]
-
+ The whole escape sequence format is the following:[br][br]
+ [example]
+ [b]<cr>!<escape_command><cr><visible text><cr>[/b][br]
+ [/example]
+ [note]
+ [b]<cr>[/b] is the carriage return character. You can obtain it by using the [fnc]$cr[/fnc] function.[br]
+ [b]<visible text>[/b] is the text that will appear as [i]link[/i] when you move the mouse over it.[br]
+ [b]<escape_command>[/b] is the description of the actions to be taken when the user interacts with the link.[br]
+ The [<escape_command> has the two following syntactic forms:[br]
+ [b]<escape_command> ::= <user_defined_commands>[/b][br]
+ [b]<escape_command> ::= <builtin_link_description>[/b]
+ [/note]
[big]User defined links[/big][br]
The user defined links allow you to perform arbitrary commands when the user interacts with the link.[br]
The commands are specified in the <escape_command> part by using the following syntax:[br]
- <escape_command> ::= <user_defined_commands>[br]
- <user_defined_commands> ::= <command_rule> [<user_defined_commands>][br]
- <command_rule> ::= <action_tag><command>[br]
- <action_tag> ::= "[!" <action> "]"[br]
- <action> ::= "rbt" | "mbt" | "dbl" | "txt"[br]
- <command> ::= any KVIrc command (see notes below)[br]
-
+ [note]
+ <escape_command> ::= <user_defined_commands>[br][br]
+ <user_defined_commands> ::= <command_rule> [<user_defined_commands>][br][br]
+ <command_rule> ::= <action_tag><command>[br][br]
+ <action_tag> ::= "[!" <action> "]"[br][bt]
+ <action> ::= "rbt" | "mbt" | "dbl" | "txt"[br][br]
+ <command> ::= any KVIrc command (see notes below)[br]
+ [/note]
[big]A shortcut[/big]
You may have a look at the [fnc]$fmtlink[/fnc] function: it does automatically some of the job explained
in this document.[br]
-
+ @seealso:
+ [fnc]$fmtlink[/fnc]
+ [fnc]$cr[/fnc]
+
*/
// FIXME: #warning "Finish the doc above!! Maybe some examples ?!"
diff --git a/src/modules/system/Plugin.cpp b/src/modules/system/Plugin.cpp
index 5b0e1c3f0..8cee964f6 100644
--- a/src/modules/system/Plugin.cpp
+++ b/src/modules/system/Plugin.cpp
@@ -50,58 +50,54 @@
The important thing is that these so/dll-files export some of the following functions.
[br][br]
[b]Exported functions by easyplugin (C/C++-Examples):[/b][br]
- [br][b]_free function[/b] [i] (needed)[/i][br]
+ [b]_free function[/b] [i] (needed)[/i][br][br]
This function is important! Since KVIrc can not free directly the memory of the dll, the plugins need the _free function so that the memory can be freed by the plugin to prevent memory-leaks.[br]
[example]
- int _free(void * p)[br]
- {[br]
- // Always free the memory here![br]
- free(p);[br]
- return 0;[br]
- }[br]
+ int _free(void * p)
+ {
+ // Always free the memory here!
+ free(p);
+ return 0;
+ }
[/example]
-
- [br][b]_load function[/b] [i](optional)[/i][br]
+ [b]_load function[/b] [i](optional)[/i][br][br]
After the plugin has be loaded, KVIrc will call the _load-function. Here you can prepare your plugin stuff.
[example]
- int _load()[br]
- {[br]
- return 0;[br]
- }[br]
+ int _load()
+ {
+ return 0;
+ }
[/example]
-
- [br][b]_unload function[/b] [i]((optional)[/i][br]
+ [b]_unload function[/b] [i]((optional)[/i][br][br]
This function will be called before the plugins is unloaded. In this function you can clean up memory or other things.
After this call there is no guarantee that the plugin will be kept in memory.[br]
[example]
- int _unload()[br]
- {[br]
- return 0;[br]
- }[br]
+ int _unload()
+ {
+ return 0;
+ }
[/example]
-
[br][b]_canunload function[/b] [i](optional)[/i][br]
The _canunload-function will be called by KVIrc to check if it may unload the plugin.
If return value is true KVIrc will unload the plugin, false means he will try unloading it at the next check.[br]
Important: KVIrc will ignore this if unload of plugins will be forced! So you have to be sure that the _unload function of your plugins cleans up![br]
[example]
- int _canunload()[br]
- {[br]
- return 0; [br]
- }[br]
+ int _canunload()
+ {
+ return 0;
+ }
[/example]
-
[br][b]user function[/b][br]
This is the general structure of a user function call.[br]
The important thing here is the handling of return values. To return a value to KVIrc you have to allocate memory and write the pointer to it into pBuffer.[br]
Have a look at the example for more details.[br]
[example]
- int about(int argc, char * argv[], char ** pBuffer)[br]
- {[br]
- *pBuffer = (char*)malloc(1024);[br]
- sprintf((char*)*pBuffer, "Hello World"); [br]
- return 1;[br]
- }[br]
+ int about(int argc, char * argv[], char ** pBuffer)
+ {
+ *pBuffer = (char*)malloc(1024);
+ sprintf((char*)*pBuffer, "Hello World");
+ return 1;
+ }
[/example]
*/